getToken abstract method Null safety

FutureOr<AuthToken?>? getToken(
  1. AuthServer server,
  2. {String? byAccessToken,
  3. String? byRefreshToken}
)

Returns a AuthToken searching by its access token or refresh token.

Exactly one of byAccessToken and byRefreshToken may be non-null, if not, this method must throw an error.

If byAccessToken is not-null and there exists a matching AuthToken.accessToken, return that token. If byRefreshToken is not-null and there exists a matching AuthToken.refreshToken, return that token.

If no match is found, return null.

server is the AuthServer requesting the AuthToken.

Implementation

FutureOr<AuthToken?>? getToken(
  AuthServer server, {
  String? byAccessToken,
  String? byRefreshToken,
});