User class

Model for the user's info.

Annotations
  • @immutable

Constructors

User({required String id, String? name, String? image, String role = 'user', UserType type = UserType.regular, Map<String, Object?>? custom})
Creates a user with the provided id.
const
User.anonymous()
Creates an anonymous user.
const
User.guest(String userId)
Creates a guest user with the provided id.
const

Properties

custom Map<String, Object?>
The user's custom data.
final
hashCode int
The hash code for this object.
no setterinherited
id String
The user's id.
final
image String?
The user's image URL.
final
name String
A computed property that can be used for UI elements where you need to display user's identifier. If a name value was provided on initialisation it will return it. Otherwise returns the id.
no setter
originalName String?
User's name that was provided when the object was created. It will be used when communicating with the API and in cases where it doesn't make sense to override null values with the non-null id.
final
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
role String
The user's role.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
type UserType
The user authorization type.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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