stopRecording method

void stopRecording({
  1. bool isNeedToShowError = true,
})

Implementation

void stopRecording({bool isNeedToShowError = true}) {
  if (dispatchId == null) {
    // No dispatchId available, fetch it first
    getRecordingDispatchedId(
      isNeedToShowError: isNeedToShowError,
      onComplete: () {
        if (dispatchId != null) {
          _attemptStopRecording(isNeedToShowError: isNeedToShowError);
        } else {
          isRecordingActionInProgress = false;
          if (isNeedToShowError) {
            sendMessageToUI(
                "Unable to stop recording: dispatch ID not found.");
          }
        }
      },
    );
  } else {
    _attemptStopRecording(isNeedToShowError: isNeedToShowError);
  }
}