set static method

void set({
  1. required List<TokenManagerBuilder<TokenManager>> tokenManagerBuilders,
  2. List<IdentityProviderBuilder<Object>> identityProviderBuilders = const [],
  3. AuthUsersConfig authUsersConfig = const AuthUsersConfig(),
  4. UserProfileConfig userProfileConfig = const UserProfileConfig(),
})

Creates a new AuthServices instance and sets it as the global instance.

tokenManagerBuilders is the list of token manager builders. The first in the list will be used as the primary token manager, and the others as additional token managers.

identityProviderBuilders is a list of IdentityProviderBuilder that build the identity providers used by authentication endpoints. Each one creates a provider instance with the appropriate token manager dependency.

authUsersConfig is the configuration for the auth users manager that will be used to create the auth users manager.

userProfileConfig is the configuration for the user profiles manager that will be used to create the user profiles manager.

These are passed to the AuthServices constructor to create the instance.

Implementation

static void set({
  required final List<TokenManagerBuilder> tokenManagerBuilders,
  final List<IdentityProviderBuilder> identityProviderBuilders = const [],
  final AuthUsersConfig authUsersConfig = const AuthUsersConfig(),
  final UserProfileConfig userProfileConfig = const UserProfileConfig(),
}) {
  final instance = AuthServices(
    primaryTokenManagerBuilder: tokenManagerBuilders.first,
    identityProviderBuilders: identityProviderBuilders,
    additionalTokenManagerBuilders: tokenManagerBuilders.skip(1).toList(),
    authUsers: AuthUsers(config: authUsersConfig),
    userProfiles: UserProfiles(config: userProfileConfig),
  );
  _instance = instance;
}