MMessageContent class abstract
Represents the content of a message in Matrix.
The msgType
field represents the type of the message.
The body
field represents the body of the message.
The topic
field represents the topic of the message.
The name
field represents the name of the message.
The guestAccess
field represents the guest access of the message.
The historyVisibility
field represents the history visibility of the message.
The joinRule
field represents the join rule of the message.
The alias
field represents the alias of the message.
The creator
field represents the creator of the message.
The roomVersion
field represents the room version of the message.
The users
field represents the users associated with the message.
The membership
field represents the membership event type of the message.
The displayName
field represents the display name of the message.
The url
field represents the URL of the message.
This class corresponds to the message content 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-content.
To create an instance of MessageContent
, use the provided factory constructors or the fromJson
method.
It is also possible to create an initial instance of MessageContent
using the initial
factory constructor.
Example usage:
final content = MessageContent.fromJson(jsonData);
final msgType = content.msgType;
final body = content.body;
final topic = content.topic;
- Available extensions
- Annotations
-
- @freezed
Constructors
-
MMessageContent({@JsonKey.new(name: 'msgtype') String? msgType, @JsonKey.new(name: 'body') String? body, @JsonKey.new(name: 'topic') String? topic, @JsonKey.new(name: 'name') String? name, @JsonKey.new(name: 'guest_access') String? guestAccess, @JsonKey.new(name: 'history_visibility') String? historyVisibility, @JsonKey.new(name: 'join_rule') String? joinRule, @JsonKey.new(name: 'alias') String? alias, @JsonKey.new(name: 'creator') String? creator, @JsonKey.new(name: 'room_version') String? roomVersion, @JsonKey.new(name: 'users') Map<
String, dynamic> ? users, @JsonKey.new(name: 'membership') MembershipEventTypes? membership, @JsonKey.new(name: 'displayname') String? displayName, @JsonKey.new(name: 'redacts') String? redacts, @JsonKey.new(name: 'redacted_because') Map<String, dynamic> ? redactedBecause, @JsonKey.new(name: 'url') String? url}) -
Creates a MMessageContent instance.
factory
-
MMessageContent.fromJson(Map<
String, dynamic> json) -
Creates a MMessageContent instance from a JSON map.
factory
- MMessageContent.initial()
-
Creates an initial MMessageContent instance.
factory
Properties
- alias → String?
-
no setterinherited
- body → String?
-
no setterinherited
-
copyWith
→ $MMessageContentCopyWith<
MMessageContent> -
Create a copy of MMessageContent
with the given fields replaced by the non-null parameter values.
no setterinherited
- creator → String?
-
no setterinherited
- displayName → String?
-
no setterinherited
- guestAccess → String?
-
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- historyVisibility → String?
-
no setterinherited
- joinRule → String?
-
no setterinherited
- membership → MembershipEventTypes?
-
no setterinherited
- msgType → String?
-
no setterinherited
- name → String?
-
no setterinherited
-
redactedBecause
→ Map<
String, dynamic> ? -
no setterinherited
- redacts → String?
-
no setterinherited
- roomVersion → String?
-
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- topic → String?
-
no setterinherited
- url → String?
-
no setterinherited
-
users
→ Map<
String, dynamic> ? -
no setterinherited
Methods
-
map<
TResult extends Object?> (TResult $default(_MMessageContent value)) → TResult -
Available on MMessageContent, provided by the MMessageContentPatterns extension
Aswitch
-like method, using callbacks. -
mapOrNull<
TResult extends Object?> (TResult? $default(_MMessageContent value)?) → TResult? -
Available on MMessageContent, provided by the MMessageContentPatterns extension
A variant ofmap
that fallback to returningnull
. -
maybeMap<
TResult extends Object?> (TResult $default(_MMessageContent value)?, {required TResult orElse()}) → TResult -
Available on MMessageContent, provided by the MMessageContentPatterns extension
A variant ofmap
that fallback to returningorElse
. -
maybeWhen<
TResult extends Object?> (TResult $default(String? msgType, String? body, String? topic, String? name, String? guestAccess, String? historyVisibility, String? joinRule, String? alias, String? creator, String? roomVersion, Map< String, dynamic> ? users, MembershipEventTypes? membership, String? displayName, String? redacts, Map<String, dynamic> ? redactedBecause, String? url)?, {required TResult orElse()}) → TResult -
Available on MMessageContent, provided by the MMessageContentPatterns 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 MMessageContent to a JSON map.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
TResult extends Object?> (TResult $default(String? msgType, String? body, String? topic, String? name, String? guestAccess, String? historyVisibility, String? joinRule, String? alias, String? creator, String? roomVersion, Map< String, dynamic> ? users, MembershipEventTypes? membership, String? displayName, String? redacts, Map<String, dynamic> ? redactedBecause, String? url)) → TResult -
Available on MMessageContent, provided by the MMessageContentPatterns extension
Aswitch
-like method, using callbacks. -
whenOrNull<
TResult extends Object?> (TResult? $default(String? msgType, String? body, String? topic, String? name, String? guestAccess, String? historyVisibility, String? joinRule, String? alias, String? creator, String? roomVersion, Map< String, dynamic> ? users, MembershipEventTypes? membership, String? displayName, String? redacts, Map<String, dynamic> ? redactedBecause, String? url)?) → TResult? -
Available on MMessageContent, provided by the MMessageContentPatterns extension
A variant ofwhen
that fallback to returningnull
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited