SupaAuthManager class
Class for handling Supabase Authorization
apiKey are required to use this class prefs is needed for storing login informat loginStateNotifier is needed for notifying users of login state changes
Constructors
- SupaAuthManager({required SupabaseClient client, required SharedPreferences prefs, required String apiKey, required LoginStateNotifier? loginStateNotifier, String? emailRedirectUrl})
Properties
- apiKey → String
-
final
- client ↔ SupabaseClient
-
getter/setter pair
- emailRedirectUrl → String?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- loginStateNotifier → LoginStateNotifier?
-
final
-
onLoginStateChange
→ Stream<
bool> -
A stream that emits
truewhen the user is logged in andfalseotherwise. This is the stream that the rest of the app should listen to.no setter - prefs → SharedPreferences
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createUser(
String email, String password) → Future< Result< bool> > - Create a new user
-
deleteCurrentUser(
) → Future< Result< bool> > - Delete the current user. WARNING: This will delete the current user
-
getPersistSessionString(
Session session) → String -
getUser(
) → DatabaseUser? - Get the stored user information
-
getUserEmail(
) → String? - Get the stored user email
-
getUserFromAuth(
) → DatabaseUser? - Get the current logged in user
-
getUserPassword(
) → String? - Get the stored user password
-
isLoggedIn(
) → bool - Are we logged in?
-
loadUser(
) → Future< DatabaseUser?> - When an app starts, call this to load any already logged in user
-
login(
String email, String password) → Future< Result< DatabaseUser> > - Login an existing user
-
logout(
) → void - Logout the current user
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refreshSession(
) → Future< bool> - Refresh the current session
-
resetPassword(
String email, [String? redirect]) → void -
Reset the password for the given email
TODO: Not sure if this is working correctly
emailemail to reset -
toString(
) → String -
A string representation of this object.
inherited
-
updateUserPassword(
String email, String password) → Future< User?> - Update user's password TODO: Not sure if this is working correctly
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited