markUnread method
Sets an unread flag manually for this room. This changes the local account data model before syncing it to make sure this works if there is no connection to the homeserver. This does not set a read marker!
Implementation
Future<void> markUnread(bool unread) async {
final content = MarkedUnread(unread).toJson();
await _handleFakeSync(
SyncUpdate(
nextBatch: '',
rooms: RoomsUpdate(
join: {
id: JoinedRoomUpdate(
accountData: [
BasicRoomEvent(
content: content,
roomId: id,
type: EventType.markedUnread,
),
],
)
},
),
),
);
await client.setAccountDataPerRoom(
client.userID!,
id,
EventType.markedUnread,
content,
);
}