onMessage<T> method
void Function()
onMessage<T>(
- void handler(
- T
Register a message handler. Returns a function to unsubscribe.
Implementation
void Function() onMessage<T>(void Function(T) handler) {
_handlers.add(handler as void Function(dynamic));
return () {
_handlers.remove(handler);
};
}