SpeechToTextV2.viaThirdPartyAuthenticator constructor

SpeechToTextV2.viaThirdPartyAuthenticator(
  1. ThirdPartyAuthenticator thirdPartyAuthenticator, {
  2. required String projectId,
  3. String? cloudSpeechEndpoint,
  4. Map<String, String>? metadata,
})

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

Implementation

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