MMessage class abstract
Represents a Matrix message.
The eventType
field represents the type of the event.
The sender
field represents the unique identifier of the sender.
The content
field represents the content of the message.
The timeStamp
field represents the timestamp of the message.
The eventID
field represents the unique identifier of the event.
The roomID
field represents the unique identifier of the room.
The stateKey
field represents the state key of the message.
This class corresponds to the message object defined in the Matrix API specification. For more details, refer to the API documentation at https://matrix.org/docs/spec/client_server/latest#message-event.
To create an instance of Message
, use the provided factory constructors or the fromJson
method.
It is also possible to create an initial instance of Message
using the initial
factory constructor.
Example usage:
final message = Message.fromJson(jsonData);
final eventType = message.eventType;
final sender = message.sender;
final content = message.content;
- Available extensions
- Annotations
-
- @freezed
Constructors
- MMessage.new({@JsonKey(name: 'type') String? eventType, @JsonKey(name: 'sender') String? sender, @JsonKey(name: 'content') MMessageContent? content, @JsonKey(name: 'origin_server_ts') int? timeStamp, @JsonKey(name: 'event_id') String? eventID, @JsonKey(name: 'room_id') String? roomID, @JsonKey(name: 'state_key') String? stateKey, @JsonKey(name: 'redacts') String? redacts})
-
Creates a MMessage instance.
factory
-
MMessage.fromJson(Map<
String, dynamic> json) -
Creates a MMessage instance from a JSON map.
factory
- MMessage.initial()
-
Creates an initial MMessage instance.
factory
Properties
- content → MMessageContent?
-
no setterinherited
-
copyWith
→ $MMessageCopyWith<
MMessage> -
Create a copy of MMessage
with the given fields replaced by the non-null parameter values.
no setterinherited
- eventID → String?
-
no setterinherited
- eventType → String?
-
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- redacts → String?
-
no setterinherited
- roomID → String?
-
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sender → String?
-
no setterinherited
- stateKey → String?
-
no setterinherited
- timeStamp → int?
-
no setterinherited
Methods
-
map<
TResult extends Object?> (TResult $default(_MMessage value)) → TResult -
Available on MMessage, provided by the MMessagePatterns extension
Aswitch
-like method, using callbacks. -
mapOrNull<
TResult extends Object?> (TResult? $default(_MMessage value)?) → TResult? -
Available on MMessage, provided by the MMessagePatterns extension
A variant ofmap
that fallback to returningnull
. -
maybeMap<
TResult extends Object?> (TResult $default(_MMessage value)?, {required TResult orElse()}) → TResult -
Available on MMessage, provided by the MMessagePatterns extension
A variant ofmap
that fallback to returningorElse
. -
maybeWhen<
TResult extends Object?> (TResult $default(String? eventType, String? sender, MMessageContent? content, int? timeStamp, String? eventID, String? roomID, String? stateKey, String? redacts)?, {required TResult orElse()}) → TResult -
Available on MMessage, provided by the MMessagePatterns extension
A variant ofwhen
that fallback to anorElse
callback. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Serializes this MMessage to a JSON map.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
TResult extends Object?> (TResult $default(String? eventType, String? sender, MMessageContent? content, int? timeStamp, String? eventID, String? roomID, String? stateKey, String? redacts)) → TResult -
Available on MMessage, provided by the MMessagePatterns extension
Aswitch
-like method, using callbacks. -
whenOrNull<
TResult extends Object?> (TResult? $default(String? eventType, String? sender, MMessageContent? content, int? timeStamp, String? eventID, String? roomID, String? stateKey, String? redacts)?) → TResult? -
Available on MMessage, provided by the MMessagePatterns extension
A variant ofwhen
that fallback to returningnull
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited