MRoomState class abstract
Represents the state events of a room.
The events
field contains a list of state events.
This class corresponds to the room state object defined in the Matrix API specification. For more details, refer to the API documentation at https://matrix.org/docs/spec/client_server/latest#room-state-object.
To create an instance of RoomState
, use the provided factory constructors or the fromJson
method.
It is also possible to create an initial instance of RoomState
using the initial
factory constructor.
Example usage:
final state = RoomState.fromJson(jsonData);
final events = state.events;
- Available extensions
- Annotations
-
- @Freezed.new(makeCollectionsUnmodifiable: false)
Constructors
-
MRoomState({@JsonKey.new(name: 'events') List<
MMessage?> ? events}) -
Creates a MRoomState instance.
factory
-
MRoomState.fromJson(Map<
String, dynamic> json) -
Creates a MRoomState instance from a JSON map.
factory
- MRoomState.initial()
-
Creates an initial MRoomState instance.
factory
Properties
-
copyWith
→ $MRoomStateCopyWith<
MRoomState> -
Create a copy of MRoomState
with the given fields replaced by the non-null parameter values.
no setterinherited
-
events
→ List<
MMessage?> ? -
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
map<
TResult extends Object?> (TResult $default(_MRoomState value)) → TResult -
Available on MRoomState, provided by the MRoomStatePatterns extension
Aswitch
-like method, using callbacks. -
mapOrNull<
TResult extends Object?> (TResult? $default(_MRoomState value)?) → TResult? -
Available on MRoomState, provided by the MRoomStatePatterns extension
A variant ofmap
that fallback to returningnull
. -
maybeMap<
TResult extends Object?> (TResult $default(_MRoomState value)?, {required TResult orElse()}) → TResult -
Available on MRoomState, provided by the MRoomStatePatterns extension
A variant ofmap
that fallback to returningorElse
. -
maybeWhen<
TResult extends Object?> (TResult $default(List< MMessage?> ? events)?, {required TResult orElse()}) → TResult -
Available on MRoomState, provided by the MRoomStatePatterns 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 MRoomState to a JSON map.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
TResult extends Object?> (TResult $default(List< MMessage?> ? events)) → TResult -
Available on MRoomState, provided by the MRoomStatePatterns extension
Aswitch
-like method, using callbacks. -
whenOrNull<
TResult extends Object?> (TResult? $default(List< MMessage?> ? events)?) → TResult? -
Available on MRoomState, provided by the MRoomStatePatterns extension
A variant ofwhen
that fallback to returningnull
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited