MUser class abstract
Represents a Matrix user
The userID field contains the unique identifier of the user.
The deviceId field contains the identifier of the user's device.
The displayName field contains the display name of the user.
The accessToken field contains the access token associated with the user.
The avatarUri field contains the URI to the user's avatar.
The isSignedIn field indicates whether the user is currently signed in.
This class corresponds to the user object defined in the Matrix API specification. For more details, refer to the API documentation at https://matrix.org/docs/spec/client_server/latest#user-object.
To create an instance of User, use the provided factory constructors or the fromJson method.
It is also possible to create an initial instance of User using the initial factory constructor.
Example usage:
final user = User.fromJson(jsonData);
final userID = user.userID;
final displayName = user.displayName;
- Available extensions
- Annotations
-
- @freezed
Constructors
- MUser({@JsonKey.new(name: 'user_id') String? userID, @JsonKey.new(name: 'device_id') String? deviceId, @JsonKey.new(name: 'display_name') String? displayName, @JsonKey.new(name: 'access_token') String? accessToken, @JsonKey.new(name: 'avatar_url') String? avatarUri, @JsonKey.new(name: 'isSignedIn') bool? isSignedIn})
-
Creates a User instance.
factory
-
MUser.fromJson(Map<
String, dynamic> json) -
Creates a User instance from a JSON map.
factory
- MUser.initial()
-
Creates an initial User instance.
factory
Properties
- accessToken → String?
-
no setterinherited
- avatarUri → String?
-
no setterinherited
-
copyWith
→ $MUserCopyWith<
MUser> -
Create a copy of MUser
with the given fields replaced by the non-null parameter values.
no setterinherited
- deviceId → String?
-
no setterinherited
- displayName → String?
-
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isSignedIn → bool?
-
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- userID → String?
-
no setterinherited
Methods
-
map<
TResult extends Object?> (TResult $default(_MUser value)) → TResult -
Available on MUser, provided by the MUserPatterns extension
Aswitch-like method, using callbacks. -
mapOrNull<
TResult extends Object?> (TResult? $default(_MUser value)?) → TResult? -
Available on MUser, provided by the MUserPatterns extension
A variant ofmapthat fallback to returningnull. -
maybeMap<
TResult extends Object?> (TResult $default(_MUser value)?, {required TResult orElse()}) → TResult -
Available on MUser, provided by the MUserPatterns extension
A variant ofmapthat fallback to returningorElse. -
maybeWhen<
TResult extends Object?> (TResult $default(String? userID, String? deviceId, String? displayName, String? accessToken, String? avatarUri, bool? isSignedIn)?, {required TResult orElse()}) → TResult -
Available on MUser, provided by the MUserPatterns extension
A variant ofwhenthat fallback to anorElsecallback. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Serializes this MUser to a JSON map.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
TResult extends Object?> (TResult $default(String? userID, String? deviceId, String? displayName, String? accessToken, String? avatarUri, bool? isSignedIn)) → TResult -
Available on MUser, provided by the MUserPatterns extension
Aswitch-like method, using callbacks. -
whenOrNull<
TResult extends Object?> (TResult? $default(String? userID, String? deviceId, String? displayName, String? accessToken, String? avatarUri, bool? isSignedIn)?) → TResult? -
Available on MUser, provided by the MUserPatterns extension
A variant ofwhenthat fallback to returningnull
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited