ReflectorDispatcher class

Dispatcher introspects a class instance so you can invoke its methods by their string names,

Dispatcher.dispatch("someMethod") will return a Future of whatever value it returns.

ReflectorDispatcher is mainly a wrapper around reflectable. When you process a Reflectable class, a mirror of the class's schematics is created. A ReflectorDispatcher is inititalized with that and an actual instance. Note that we don't actually pubspec depend on Reflectable here. This Dispatcher works with the results of using Reflectable to introspect a class.

Constructors

ReflectorDispatcher(dynamic instance, dynamic mirror)
constructor

Properties

hashCode int
The hash code for this object.
no setterinherited
instance ↔ dynamic
the initialized class instance we will be invoking methods on.
getter/setter pair
mirror ↔ dynamic
an introspected reflection of the instance's class's guts, predigested by reflectable
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispatch(String methodName, [dynamic positionalParams, Map<String, dynamic>? namedParams]) Future
Invoke named method with parameters on the instance and return a Future of the result, if possible.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited