User class

A class that represents user.

Annotations
  • @immutable

Constructors

User({int? createdAt, String? firstName, required String id, String? imageUrl, String? lastName, int? lastSeen, Map<String, dynamic>? metadata, Role? role, int? updatedAt})
Creates a user.
const
User.fromJson(Map<String, dynamic> json)
Creates user from a map (decoded JSON).

Properties

createdAt int?
Created user timestamp, in ms
final
firstName String?
First name of the user
final
hashCode int
The hash code for this object.
no setterinherited
id String
Unique ID of the user
final
imageUrl String?
Remote image URL representing user's avatar
final
lastName String?
Last name of the user
final
lastSeen int?
Timestamp when user was last visible, in ms
final
metadata Map<String, dynamic>?
Additional custom metadata or attributes related to the user
final
props List<Object?>
Equatable props
no setter
role Role?
User 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
updatedAt int?
Updated user timestamp, in ms
final

Methods

copyWith({String? firstName, String? imageUrl, String? lastName, int? lastSeen, Map<String, dynamic>? metadata, Role? role, int? updatedAt}) User
Creates a copy of the user with an updated data. firstName, imageUrl, lastName, lastSeen, role and updatedAt with null values will nullify existing values. metadata with null value will nullify existing metadata, otherwise both metadatas will be merged into one Map, where keys from a passed metadata will overwite keys from the previous one.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts user to the map representation, encodable to JSON.
toString() String
A string representation of this object.
inherited

Operators

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