Skip to content
pubscout

google_speech

5.3.0, released 2 years ago by felixjunghans.de

Flutter plugin for the Google Cloud gRPC Speech-to-Text API.

$ flutter pub add google_speech
Source repository

What it does

Allows Flutter apps to communicate with the Google Cloud Speech-to-Text API using gRPC. It supports audio transcription via file recognition, real-time streaming recognition, and endless stream support.

AI-written summary of version 5.3.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to transcribe audio files to text using Google Cloud Speech-to-Text in a Flutter app.
  • You require real-time streaming audio transcription or endless stream support.

Skip it when

  • You need local, on-device speech-to-text processing without a cloud backend.
  • You cannot configure Google Cloud credentials, service accounts, or tokens.

Strengths

  • Pure Dart implementation utilizing gRPC for streaming transcription support.
  • Supports multiple authentication methods including service accounts, tokens, and third-party authenticators.
  • Supports Google Speech V1, Beta, and V2 APIs.

Weaknesses

  • Requires an active Google Cloud account and properly configured credentials.
  • Streaming audio quality issues or incorrect formats can lead to empty API responses.

Setup

Kind
Flutter widgets
Effort
Medium
Code generation
No
Direct dependencies
8

Requires creating a Google Cloud account, activating the Speech API, generating a service account JSON file, and configuring permissions/credentials in the app.

import 'package:google_speech/speech_client_authenticator.dart';

final serviceAccount = ServiceAccount.fromString(r'''{YOUR_JSON_STRING}''');
final speechToText = SpeechToText.viaServiceAccount(serviceAccount);

final config = RecognitionConfig(
  encoding: AudioEncoding.LINEAR16,
  sampleRateHertz: 16000,
  languageCode: 'en-US'
);

final response = await speechToText.recognize(config, audioBytes);

Works with

Packages commonly used together with google_speech: ones it builds on, ones built on it, and its own family.