safeInvoke static method

Future<Result<Null, String>> safeInvoke(
  1. MethodChannel channel,
  2. String methodName
)

Implementation

static Future<Result<Null, String>> safeInvoke(
    MethodChannel channel, String methodName) async {
  try {
    await channel.invokeMethod<bool>(methodName);
  } on PlatformException catch (e) {
    return Result<Null, String>.bad("safeInvokeBool failed: ${e.message}");
  }
  return Result<Null, String>.good(null, "Invoked");
}