stopRecord static method

void stopRecord({
  1. VoidCallback? onRecordStart,
  2. void onRecodeDone(
    1. String path
    )?,
})

Implementation

static void stopRecord(
    {VoidCallback? onRecordStart,
    void Function(String path)? onRecodeDone}) async {
  _channel.invokeMethod("stopRecord");

  _channel.setMethodCallHandler((MethodCall call) async {
    var method = call.method;
    var back = call.arguments;
    print('native call:$method -> $back');
    switch (method) {
      case "onRecordStart":
        onRecordStart?.call();
        break;
      case "onRecodeDone":

        if(Platform.isIOS){
          String path = back["path"];
          onRecodeDone?.call(path);
        }else{
          onRecodeDone?.call(back);
        }

        break;
      default:
        throw UnsupportedError("Unrecognized JSON message");
    }
  });
}