User class

User information of the application.

This class is automatically created during application initialization and can be accessed from App.user or context.read or context.watch.

Inheritance

Constructors

User({required App<Object> app})

Properties

app App<Object>
The App that was passed in the constructor.
final
disposed bool
Whether this ProviderModel has been disposed or not.
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
id String?
The user id.
no setter
key ProviderLockKey
The ProviderLockKey used for updating user data.
no setter
properties Map<String, Object?>
The user properties.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
variables List<ProviderModelVariable>
All values of User.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addSynchronousChangeListener(FutureOr<void> callback(User user, UserChangeData changes)) → void
Adds a listener to monitor updates to user data.
begin([ProviderLockKey? lockKey]) ProviderModelBatch
Create a batch to safely modify this ProviderModel's ProviderModelVariable members.
inherited
changeId(String? id, {Map<String, Object?>? properties, Map<String, Object?>? data, Map<Type, String?>? overrideId, Map<Type, Map<String, Object?>>? overrideProperties}) Future<void>
Sets the user's id and various values.
changeIdWithBatch({required ProviderModelBatch batch, required String? id, Map<String, Object?>? properties, Map<String, Object?>? data, Map<Type, String?>? overrideId, Map<Type, Map<String, Object?>>? overrideProperties}) Future<void>
Sets the user's id and various values using the provided ProviderModelBatch.
createUnsetVariable<U>() ProviderModelVariable<U>
Creates an unset ProviderModelVariable belonging to this ProviderModel that can be used in batches and automatically detect changes to notify listeners when it's value changes.
inherited
createVariable<U>(U initial) ProviderModelVariable<U>
Create a ProviderModelVariable belonging to this ProviderModel that can be used in batches and automatically detect changes to notify listeners when it's value changes.
inherited
dispose() → void
Dipose this ProviderModel. This will call dispose on all ProviderModelVariables created by this ProviderModel. This will also cancel all ProviderModelUseSubscriptions created by this ProviderModel.
inherited
getData<T extends Object?>(String key) Future<T?>
Retrieves arbitrary data.
getDataSync<T extends Object?>(String key) → T?
Synchronous process of getData
getIdFor<T>() String?
Retrieves the id that has been overridden for each Type.
getPropertiesFor<T>() Map<String, Object?>
Retrieves the properties that have been overridden for each Type.
getProperty<T>(String key, [T? defaultValue]) → T?
Retrieves the value specified by key from properties.
lock(ProviderModelProcess process, {ProviderLockKey? lockKey, bool override = false, bool overridable = false, FutureOr<void> onOverride()?, bool waitForMicrotasks = true, bool waitForTimers = false, bool waitForPeriodicTimers = false}) Future<bool>
Queue up to lock this ProviderModel to safely modify it's ProviderModelVariable members. The process passed here is guarunteed to be executed sequentially and non-parallel to other proccesses passed to lock.
inherited
locked(ProviderLockKey lockKey) bool
Whether this ProviderModel is locked with lockKey or not.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeAllData() Future<void>
Removes all the data that was set using setData and similar functions.
removeData(String key) Future<void>
Removes the data of key that was set using setData or similar functions.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removeSynchronousChangeListener(FutureOr<void> callback(User user, UserChangeData changes)) → void
Removes the listener that was added using addSynchronousChangeListener.
set({Map<String, Object?>? properties, Map<String, Object?>? data, Map<Type, Map<String, Object?>>? overrideProperties}) Future<void>
Sets the properties and arbitrary data.
setData<T extends Object?>(String key, T value) Future<void>
Sets arbitrary data.
setProperties(Map<String, Object?> properties, {Map<Type, Map<String, Object?>>? overrideProperties}) Future<void>
Sets a property.
setWithBatch({required ProviderModelBatch batch, Map<String, Object?>? properties, Map<String, Object?>? data, Map<Type, Map<String, Object?>>? overrideProperties}) Future<void>
Sets the properties and arbitrary data using the provided ProviderModelBatch.
toString() String
A string representation of this object.
inherited
use(void callback(User model)) ProviderModelUseSubscription<User>
Subscribe to changes to this ProviderModel. The callback passed here will be called whenever a ProviderModelVariable belonging to this ProviderModel that was accessed inside the callback changes. The callback will be called immediately once during execution of this function synchronously.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override