methodInvoker function

Future<void> methodInvoker(
  1. MethodChannel channel,
  2. String eventName, [
  3. dynamic params
])

Implementation

Future<void> methodInvoker(MethodChannel channel, String eventName, [dynamic params]) async {
  try {
    await channel.invokeMethod<void>(eventName, params ?? {'data': 'empty'});
  } on PlatformException catch (e) {
    print(e.message);
  }
}