SpeechToText.viaThirdPartyAuthenticator constructor

SpeechToText.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 = SpeechToText.viaThirdPartyAuthenticator( ThirdPartyAuthenticator( obtainCredentialsFromThirdParty: () async { // request api to get token final json = await requestCredentialFromMyApi(); return AccessCredentials.fromJson(json); }, ), );

Implementation

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