RoomUser class abstract

A member of a room with their assigned role.

Equality is id-based on userId so a Set<RoomUser> deduplicates by user regardless of role transitions during a single render pass.

displayName and avatarUrl are populated only when the member list is fetched with the users expansion (see ChatMembersApi.list's expand param). Without expansion the backend emits just {userId, role} and both stay null — render group members by resolving the id through the user cache as before. With expansion they let consumers render the roster (names + avatars) straight from the list response, with no per-member GET /users/{id} round-trip (the N+1 the expansion eliminates).

Available extensions
Annotations
  • @Freezed.new(equal: false)

Constructors

RoomUser({required String userId, @Default.new(RoomRole.member) RoomRole role, String? displayName, String? avatarUrl})
const
factory

Properties

avatarUrl String?
Member avatar URL. Non-null only on an expanded list response.
no setterinherited
copyWith → $RoomUserCopyWith<RoomUser>
Create a copy of RoomUser with the given fields replaced by the non-null parameter values.
no setterinherited
displayName String?
Member display name. Non-null only on an expanded list response.
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
role RoomRole
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
userId String
no setterinherited

Methods

map<TResult extends Object?>(TResult $default(_RoomUser value)) → TResult

Available on RoomUser, provided by the RoomUserPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>(TResult? $default(_RoomUser value)?) → TResult?

Available on RoomUser, provided by the RoomUserPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>(TResult $default(_RoomUser value)?, {required TResult orElse()}) → TResult

Available on RoomUser, provided by the RoomUserPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>(TResult $default(String userId, RoomRole role, String? displayName, String? avatarUrl)?, {required TResult orElse()}) → TResult

Available on RoomUser, provided by the RoomUserPatterns extension

A variant of when that fallback to an orElse callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>(TResult $default(String userId, RoomRole role, String? displayName, String? avatarUrl)) → TResult

Available on RoomUser, provided by the RoomUserPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>(TResult? $default(String userId, RoomRole role, String? displayName, String? avatarUrl)?) → TResult?

Available on RoomUser, provided by the RoomUserPatterns extension

A variant of when that fallback to returning null

Operators

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