ChatMessage class

Annotations

Constructors

ChatMessage({required String text, ChatMedia? chatMedia, required bool isSender, DateTime? createdAt})
Creates a chat message containing either text or chatMedia, but not both.
const
ChatMessage.fromJson(String jsonStr)
Decodes a JSON string into a ChatMessage.
factory
ChatMessage.fromMap(Map<String, dynamic> map)
Creates a message from a Map, e.g. from decoded JSON.
factory

Properties

chatMedia → ChatMedia?
The media content of the message. Mutually exclusive with text.
final
createdAt → DateTime?
When the message was created.
final
hashCode → int
The hash code for this object.
no setteroverride
isSender → bool
Whether this message was sent by the local user.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
text → String
The textual content of the message. Mutually exclusive with chatMedia.
final

Methods

copyWith({String? text, ChatMedia? chatMedia, bool? isSender, DateTime? createdAt}) → ChatMessage
Returns a copy of this message, replacing only the given fields.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → String
Encodes this message to a JSON string.
toMap() → Map<String, dynamic>
Converts this message to a JSON‐compatible map.
toString() → String
A string representation of this object.
override

Operators

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