stopRecording method
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
- GemError.success Successfully transitioned to the RecorderStatus.stopped or RecorderStatus.restarting state.
- GemError.recordedLogTooShort If the recorded log duration is shorter than the RecorderConfiguration.minDurationSeconds set in recorder configuration.
- GemError.busy The recorder could not transition to RecorderStatus.stopping because it is busy with another operation.
- GemError.general A general error occurred while attempting to stop the recording.
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']);
}