dart_board_authentication 1.2.0 copy "dart_board_authentication: ^1.2.0" to clipboard
dart_board_authentication: ^1.2.0 copied to clipboard

outdated

Authentication feature. Provides LoginButton() and the ability to register authentication delegates.

dart_board_authentication #

Authentication Abstraction for Dart-Board

Getting Started #

By itself, this module does nothing. It needs to be paired with an auth-provider.

Firebase is provided for this via the dart_board_firebase_authentication, or you can implement your own

Usage #

Reading/Listening to stae #

You can access AuthenticationState with locator. e.g. locate<AuthenticationState>() it is stored as a global for your application and available everywhere.

AuthenticationState provides the following

bool get signedIn => _activeDelegate != null;
String get photoUrl => _activeDelegate?.photoUrl ?? "";
String get username => _activeDelegate?.username ?? "anon";

It is also a ChangeNotifier so if you want to listen to updates, you can use `locateAndBuild

Signing in #

Call the static global AuthenticationState.requestSignIn() to start the log in flow in a dialog.

Alternatively, use

LoginButton() widget.

Writing a Delegate #

  1. Create a new feature in a clean flutter module.
  2. Import dart_board_core and dart_board_authentication.
  3. Define authentication feature as a dependency.
  4. Implement the AuthenticationDelegate class
  5. Notify AuthenticationState of auth changes in your delegate
  6. Provide DartBoardAuthenticationProviderAppDecoration
  7. Import and register your feature into your integration.
    1. The Auth feature will delegate out to it's auth options
    2. The delegates register themselves via an AppDecoration

The example contains a mock delegate that can be used as a starting point, or refer to dart_board_firebase_authentication for a real world example.

0
likes
0
pub points
0%
popularity

Publisher

verified publisherdart-board.io

Authentication feature. Provides LoginButton() and the ability to register authentication delegates.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

dart_board_core, dart_board_locator, dart_board_widgets, flutter

More

Packages that depend on dart_board_authentication