recognize method

Future<RecognizeResponse> recognize(
  1. RecognitionConfigBeta config,
  2. List<int> audio
)

Sends a RecognizeRequest request to the Google Speech Api. Requires a RecognitionConfig and an RecognitionAudio.

Audio files transcribed with recognize must not be longer than 60 seconds. For longer audio files longRunningRecognize must be used.

Implementation

Future<RecognizeResponse> recognize(
    RecognitionConfigBeta config, List<int> audio) {
  final client = SpeechClient(_channel, options: _options);

  // transform audio to RecognitionAudio
  final recognitionAudio = RecognitionAudio()..content = audio;

  // Create the request, which transmits the necessary
  // data to the Google Api.
  final request = (RecognizeRequest()
    ..config = config.toConfig()
    ..audio = recognitionAudio);
  return client.recognize(request);
}