getClient method Null safety

  1. @override
Future<AuthClient?> getClient(
  1. AuthServer server,
  2. String? clientID
)
override

Must return AuthClient for a client ID.

This method must return an instance of AuthClient if one exists for clientID. Otherwise, it must return null. server is the AuthServer requesting the AuthClient.

Implementation

@override
Future<AuthClient?> getClient(AuthServer server, String? clientID) async {
  final query = Query<ManagedAuthClient>(context!)
    ..where((o) => o.id).equalTo(clientID);

  final storage = await query.fetchOne();

  return storage?.asClient();
}