User class

Represents a Matrix User which may be a participant in a Matrix Room.

Inheritance
Available Extensions

Constructors

User(String id, {String? membership, String? displayName, String? avatarUrl, required Room room})
factory
User.fromState({required String stateKey, Map<String, Object?> content = const {}, required String typeKey, required String senderId, required Room room, Map<String, Object?>? prevContent})

Properties

avatarUrl Uri?
The avatar if the user has one.
no setter
canBan bool
Whether the client is able to ban/unban this user.
no setter
canChangePowerLevel bool
no setter
canChangeUserPowerLevel bool
Whether the client is allowed to change the power level of this user. Please be aware that you can only set the power level to at least your own!
no setter
canKick bool
Whether the client is able to kick this user.
no setter
content Map<String, Object?>
getter/setter pairinherited
currentPresence Future<CachedPresence>
no setter
displayName String?
The displayname of the user if the user has set one.
no setter
hashCode int
The hash code for this object.
no setteroverride
id String
The full qualified Matrix ID in the format @username:server.abc.
no setter
membership Membership
The membership status of the user. One of: join invite leave ban
no setter
mention String
Get the mention text to use in a plain text body to mention this specific user in this specific room
no setter
mentionFragments Set<String>
Get the mention fragments for this user.
no setter
powerLevel int
Returns the power level of this user.
no setter
presence Presence?
The newest presence of this user if there is any and null if not.
no setter
prevContent Map<String, Object?>?
final
room Room
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
senderId String
getter/setter pairinherited
stateKey String?
getter/setter pairinherited
type String
getter/setter pairinherited

Methods

ban() Future<void>
Call the Matrix API to ban this user from this room.
calcDisplayname({bool? formatLocalpart, bool? mxidLocalPartFallback, MatrixLocalizations i18n = const MatrixDefaultLocalizations()}) String
Returns the displayname or the local part of the Matrix ID if the user has no displayname. If formatLocalpart is true, then the localpart will be formatted in the way, that all "_" characters are becomming white spaces and the first character of each word becomes uppercase. If mxidLocalPartFallback is true, then the local part of the mxid will be shown if there is no other displayname available. If not then this will return "Unknown user".
fetchCurrentPresence() Future<CachedPresence>
The newest presence of this user if there is any. Fetches it from the database first and then from the server if necessary or returns offline.
kick() Future<void>
Call the Matrix API to kick this user from this room.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setPower(int power) Future<void>
Call the Matrix API to change the power level of this user.
startDirectChat({bool? enableEncryption, List<StateEvent>? initialState, bool waitForSync = true}) Future<String>
Returns an existing direct chat ID with this user or creates a new one. Returns null on error.
toJson() Map<String, Object?>
inherited
toString() String
A string representation of this object.
inherited
unban() Future<void>
Call the Matrix API to unban this banned user from this room.

Operators

operator ==(Object other) bool
The equality operator.
override