invoke method

InstanceMirror invoke (
  1. Symbol memberName,
  2. List positionalArguments,
  3. [Map<Symbol, dynamic> namedArguments = const <Symbol, dynamic>{}]
)

Invokes the named function and returns a mirror on the result.

Let o be the object reflected by this mirror, let f be the simple name of the member denoted by memberName, let a1, ..., an be the elements of positionalArguments, let k1, ..., km be the identifiers denoted by the elements of namedArguments.keys, and let v1, ..., vm be the elements of namedArguments.values. Then this method will perform the method invocation o.f(a1, ..., an, k1: v1, ..., km: vm) in a scope that has access to the private members of o (if o is a class or library) or the private members of the class of o (otherwise).

If the invocation returns a result r, this method returns the result of calling reflect(r).

If the invocation causes a compilation error the effect is the same as if a non-reflective compilation error had been encountered.

If the invocation throws an exception e (that it does not catch), this method throws e.

Implementation

InstanceMirror invoke(Symbol memberName, List<dynamic> positionalArguments,
    [Map<Symbol, dynamic> namedArguments = const <Symbol, dynamic>{}]);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-mirrors/ObjectMirror/invoke.html