Room class abstract
A class that represents a room where 2 or more participants can chat.
- Annotations
-
- @JsonSerializable()
- @immutable
Constructors
-
Room({int? createdAt, required String id, String? imageUrl, List<
Message> ? lastMessages, Map<String, dynamic> ? metadata, String? name, required RoomType? type, int? updatedAt, required List<User> users}) -
constfactory
-
Room.fromJson(Map<
String, dynamic> json) -
Creates room from a map (decoded JSON).
factory
Properties
- createdAt → int?
-
Created room timestamp, in ms.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Room's unique ID.
final
- imageUrl → String?
-
Room's image. In case of the RoomType.direct - avatar of the second person,
otherwise a custom image RoomType.group.
final
-
lastMessages
→ List<
Message> ? -
List of last messages this room has received.
final
-
metadata
→ Map<
String, dynamic> ? -
Additional custom metadata or attributes related to the room.
final
- name → String?
-
Room's name. In case of the RoomType.direct - name of the second person,
otherwise a custom name RoomType.group.
final
-
props
→ List<
Object?> -
Equatable props.
no setter
- 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 → RoomType?
-
RoomType.
final
- updatedAt → int?
-
Updated room timestamp, in ms.
final
-
users
→ List<
User> -
List of users which are in the room.
final
Methods
-
copyWith(
{int? createdAt, String? id, String? imageUrl, List< Message> ? lastMessages, Map<String, dynamic> ? metadata, String? name, RoomType? type, int? updatedAt, List<User> ? users}) → Room -
Creates a copy of the room with an updated data.
imageUrl
,name
andupdatedAt
with null values will nullify existing valuesmetadata
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.type
andusers
with null values will be overwritten by previous values. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts room 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