User class

Class that defines a Stream Chat User.

Implementers
Annotations
  • @JsonSerializable()

Constructors

User({required String id, String? role, String? name, String? image, DateTime? createdAt, DateTime? updatedAt, DateTime? lastActive, Map<String, Object?> extraData = const {}, bool online = false, bool banned = false, DateTime? banExpires, List<String> teams = const [], String? language})
Creates a new user.
User.fromJson(Map<String, dynamic> json)
Create a new instance from json.
factory

Properties

banExpires DateTime?
The date at which the ban will expire.
final
banned bool
True if user is banned from the chat.
final
createdAt DateTime
Date of user creation.
final
extraData Map<String, Object?>
Map of custom user extraData.
final
hashCode int
The hash code for this object.
no setterinherited
id String
User id.
final
image String?
Shortcut for user image.
no setter
language String?
The language this user prefers.
final
lastActive DateTime?
Date of last user connection.
final
name String
Shortcut for user name.
no setter
online bool
True if user is online.
final
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
role String?
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
teams List<String>
User teams
final
updatedAt DateTime
Date of last user update.
final

Methods

copyWith({String? id, String? role, String? name, String? image, DateTime? createdAt, DateTime? updatedAt, DateTime? lastActive, bool? online, Map<String, Object?>? extraData, bool? banned, DateTime? banExpires, List<String>? teams, String? language}) User
Creates a copy of User with specified attributes overridden.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serialize to json.
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

toIds(List<User>? users) List<String>?
List of users to list of userIds.

Constants

topLevelFields → const List<String>
Known top level fields.