fakeRequestTokens function

RequestTokens fakeRequestTokens({
  1. required Uri origin,
  2. String? authToken,
  3. String? appCheckToken,
  4. AppCheckOutcome appCheck = AppCheckOutcome.none,
})

Tokens for the origin of origin, for the tests of products; exported only by package:_firebase_transport_dart/testing.dart, not by the main library.

Throws an ArgumentError when a token is not token text (see isTokenText), or when tokenOrigin refuses origin.

Implementation

RequestTokens fakeRequestTokens({
  required Uri origin,
  String? authToken,
  String? appCheckToken,
  AppCheckOutcome appCheck = AppCheckOutcome.none,
}) {
  if (authToken != null && !isTokenText(authToken)) {
    throw ArgumentError('authToken is not token text');
  }
  if (appCheckToken != null && !isTokenText(appCheckToken)) {
    throw ArgumentError('appCheckToken is not token text');
  }
  return RequestTokens._(
    tokenOrigin(origin),
    authToken,
    appCheckToken,
    appCheck,
  );
}