stop method

Future<RecorderState> stop()

Implementation

Future<RecorderState> stop() async {
  if (state == RecorderState.recording) {
    final audioPath = await _record.stop() ?? '';
    if (audioPath != '') {
      if (kIsWeb) {
        _curProof!.audio = audioPath;

        html.AnchorElement(href: audioPath)
          ..setAttribute('download', audioPath)
          ..click();
      } else if (File(audioPath).existsSync()) {
        _curProof!.audio = audioPath;
      } else {
        showErrorNotification(tr().error);
      }
    }

    state = RecorderState.ready;

    return RecorderState.finished;
  }

  return RecorderState.failed;
}