onEvents static method

dynamic onEvents(
  1. dynamic callback(
    1. Map res
    )
)

Implementation

static onEvents(Function(Map res) callback) async {
  try {
    final CallbackHandle handle = PluginUtilities.getCallbackHandle(callback)!;
    await _channel.invokeMethod('on', {
      'listener': 'events',
      'callbackHandle':
          handle.toRawHandle()
    });
  } on PlatformException catch (e) {
    print(e);
  }
}