stopRecording method

Future<GemError> stopRecording()

Stops the recording.

Stops the recording process and transitions the recorder status to RecorderStatus.stopping first. If the stop is successful (i.e., the recording duration meets the RecorderConfiguration.minDurationSeconds), the status will change to RecorderStatus.stopped. A notification is issued upon successful stop.

If RecorderConfiguration.continuousRecording is set to true and the recording reaches the chunk duration, the status will transition to RecorderStatus.restarting instead of RecorderStatus.stopped, and a new recording session will begin automatically.

Returns

Throws

  • An exception if it fails

Implementation

Future<GemError> stopRecording() async {
  final String? resultString = await GemKitPlatform.instance
      .getChannel(mapId: -1)
      .invokeMethod<String>(
        'callObjectMethod',
        jsonEncode(<String, Object>{
          'id': _pointerId,
          'class': 'Recorder',
          'method': 'stopRecording',
          'args': <dynamic, dynamic>{},
        }),
      );
  return GemErrorExtension.fromCode(jsonDecode(resultString!)['result']);
}