Timeline class

Represents the timeline of a room. The callback onUpdate will be triggered automatically. The initial event list will be retreived when created by the room.getTimeline() method.

Available extensions

Constructors

Timeline({required Room room, void onUpdate()?, void onChange(int index)?, void onInsert(int index)?, void onRemove(int index)?, void onNewEvent()?, required TimelineChunk chunk})

Properties

aggregatedEvents Map<String, Map<String, Set<Event>>>
Map of event ID to map of type to set of aggregated events
final
allowNewEvent bool
getter/setter pair
cancelSendEventSub StreamSubscription<String>?
getter/setter pair
canRequestFuture bool
no setter
canRequestHistory bool
no setter
chunk ↔ TimelineChunk
getter/setter pair
events List<Event>
newest events will be at index 0 apparently
no setter
hashCode int
The hash code for this object.
no setterinherited
historySub StreamSubscription<Event>?
getter/setter pair
isFragmentedTimeline bool
getter/setter pair
isRequestingFuture bool
getter/setter pair
isRequestingHistory bool
getter/setter pair
onChange → void Function(int index)?
final
onInsert → void Function(int index)?
final
onNewEvent → void Function()?
final
onRemove → void Function(int index)?
final
onUpdate → void Function()?
final
room Room
final
roomSub StreamSubscription<SyncUpdate>?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessionIdReceivedSub StreamSubscription<String>?
getter/setter pair
timelineSub StreamSubscription<Event>?
getter/setter pair

Methods

addAggregatedEvent(Event event) → void
cancelSubscriptions() → void
Don't forget to call this before you dismiss this object!
export({DateTime? from, DateTime? until, bool filter(Event)?, int requestHistoryCount = 500}) Stream<ExportResult>

Available on Timeline, provided by the TimelineExportExtension extension

Exports timeline events from a Matrix room within a specified date range.
fetchAggregatedEvents(String eventId, String relType, {String? eventType}) Future<void>
Fetches related events from the server using the /relations API and injects them into aggregatedEvents. Useful for fragmented timelines where aggregated events (e.g. poll responses) may not be in the current timeline chunk.
getEventById(String id) Future<Event?>
Searches for the event in this timeline. If not found, requests from the server. Requested events are cached.
getRoomEvents({int historyCount = Room.defaultHistoryCount, dynamic direction = Direction.b, StateFilter? filter}) Future<int>
Request more previous events from the server. historyCount defines how much events should be received maximum. When the request is answered, onHistoryReceived will be triggered before the historical events will be published in the onEvent stream. filter allows you to specify a StateFilter object to filter the events, which can include various criteria such as event types (e.g., EventTypes.Message) and other state-related filters. The StateFilter object will have lazyLoadMembers set to true by default, but this can be overridden. Returns the actual count of received timeline events.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeAggregatedEvent(Event event) → void
requestFuture({int historyCount = Room.defaultHistoryCount, StateFilter? filter}) Future<void>
Request more future events from the server. historyCount defines how many events should be received maximum. filter allows you to specify a StateFilter object to filter the events, which can include various criteria such as event types (e.g., EventTypes.Message) and other state-related filters. The StateFilter object will have lazyLoadMembers set to true by default, but this can be overridden. This method does not return a value.
requestHistory({int historyCount = Room.defaultHistoryCount, StateFilter? filter}) Future<void>
Request more previous events from the server. historyCount defines how many events should be received maximum. filter allows you to specify a StateFilter object to filter the events, which can include various criteria such as event types (e.g., EventTypes.Message) and other state-related filters. The StateFilter object will have lazyLoadMembers set to true by default, but this can be overridden. This method does not return a value.
requestKeys({bool tryOnlineBackup = true, bool onlineKeyBackupOnly = true}) → void
Request the keys for undecryptable events of this timeline
searchEvent({String? searchTerm, int requestHistoryCount = 100, int maxHistoryRequests = 10, String? sinceEventId, int? limit, bool searchFunc(Event)?}) Stream<List<Event>>
setReadMarker({String? eventId, bool? public}) Future<void>
Set the read marker to the last synced event in this timeline.
startSearch({String? searchTerm, int requestHistoryCount = 100, int maxHistoryRequests = 10, String? prevBatch, String? sinceEventId, int? limit, bool searchFunc(Event)?}) Stream<(List<Event>, String?)>
Searches searchTerm in this timeline. It first searches in the cache, then in the database and then on the server. The search can take a while, which is why this returns a stream so the already found events can already be displayed. Override the searchFunc if you need another search. This will then ignore searchTerm. Returns the List of Events and the next prevBatch at the end of the search.
toString() String
A string representation of this object.
inherited

Operators

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