flush method

Processes any remaining audio data and returns its transcription.

returns CheetahTranscript object.

Implementation

Future<CheetahTranscript> flush() async {
  try {
    Map<String, dynamic> transcript = Map<String, dynamic>.from(
        await _channel.invokeMethod('flush', {'handle': _handle}));

    if (transcript['transcript'] == null) {
      throw CheetahInvalidStateException(
          "field 'transcript' must be always present");
    }

    return CheetahTranscript(transcript['transcript'], null);
  } on PlatformException catch (error) {
    throw cheetahStatusToException(error.code, error.message);
  } on Exception catch (error) {
    throw CheetahException(error.toString());
  }
}