SpeechToTextBeta.viaThirdPartyAuthenticator constructor

SpeechToTextBeta.viaThirdPartyAuthenticator(
  1. ThirdPartyAuthenticator thirdPartyAuthenticator, {
  2. String? cloudSpeechEndpoint,
  3. Map<String, String>? metadata,
})

Creates a SpeechToText interface using a third party authenticator. Don't worry about updating the access token, the package does it automatically. Example: final speechToText = SpeechToTextBeta.viaThirdPartyAuthenticator( ThirdPartyAuthenticator( obtainCredentialsFromThirdParty: () async { // request api to get token final json = await requestCredentialFromMyApi(); return AccessCredentials.fromJson(json); }, ), );

Implementation

factory SpeechToTextBeta.viaThirdPartyAuthenticator(
  ThirdPartyAuthenticator thirdPartyAuthenticator, {
  String? cloudSpeechEndpoint,
  Map<String, String>? metadata,
}) =>
    SpeechToTextBeta._(
        thirdPartyAuthenticator.toCallOptions
            .mergedWith(CallOptions(metadata: metadata ?? {})),
        cloudSpeechEndpoint: cloudSpeechEndpoint);