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