listen static method
Listen value change
If provide key
, only receive notify when value of key
change
If key
is null, all value change will notify
Implementation
static StreamSubscription<dynamic> listen(void Function(dynamic event)? onData,
{String? key, Function? onError, void Function()? onDone, bool? cancelOnError}) {
return _eventChannel
.receiveBroadcastStream(key)
.map((event) => event)
.listen(onData, onError: onError, cancelOnError: cancelOnError, onDone: onDone);
}