UserRepository class
The repository responsible for fetching, caching, and broadcasting the authenticated driver's profile.
Fetches UserModel data from the API, persists it to SecureStorage for offline fallback, and broadcasts updates on the user stream. Also keeps the Sentry user context in sync so error reports include user identity.
Callers should prefer AuthRepository.resolveUser over calling this class directly in most cases.
Constructors
- UserRepository({required UserService userService, required SecureStorage secureStorage, required AppLogger logger})
- Creates a UserRepository.
Properties
Methods
-
clearUser(
) → Future< void> - Deletes the stored user from SecureStorage, clears the Sentry user context, and emits UserModel.empty on the user stream.
-
dispose(
) → void - Closes the user stream controller and releases resources.
-
getCachedUser(
) → Future< UserModel?> -
The UserModel currently persisted in SecureStorage, or
nullif none exists. -
getUser(
{bool notify = true}) → Future< UserModel> - Fetches the current user from the API, persists the result, and optionally broadcasts it on the user stream.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateUser(
UserModel user) → Future< void> -
Persists
userto SecureStorage, updates the Sentry user context, and broadcasts the new value on theuserstream.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited