handler<S, T> static method
- void callback(
- S
Gets an event handler at the given key.
The event handler can be of any Function type, as specified by the type
argument T.
When this method is called, the second argument, generator, is invoked.
The generator callback must return a function, which we will call
entrypoint, that matches the signature of T. The generator callback
receives an argument, which we will call trigger. The entrypoint
function must call trigger, optionally passing it any extra arguments
that should be merged into the arguments specified in each event handler.
This is admittedly a little confusing. At its core, the problem is that
this method cannot itself automatically create a function (entrypoint)
of the right type (T), and therefore a callback (generator) that knows
how to wrap a function body (trigger) in the right signature (T) is
needed to actually build that function (entrypoint).
Implementation
static T? handler<S, T>(void Function(S)? callback) {
if (callback == null) {
return null;
}
throw 'Not implemented';
}