invoke method

Future<bool> invoke({
  1. required String methodName,
  2. required dynamic arguments,
  3. required Future<void> callbacks(
    1. MethodCall call
    ),
})

Implementation

Future<bool> invoke(
    {required String methodName,
    required dynamic arguments,
    required Future<void> Function(MethodCall call) callbacks}) async {
  _methodChannel.setMethodCallHandler(callbacks);
  bool? result = false;
  try {
    result = await _methodChannel.invokeMethod<bool>(methodName, arguments);
  } on PlatformException catch (e) {
    debugPrint('$_tag:: Error = $e');
  }
  return result!;
}