getEventIdList method
Implementation
@override
Future<List<String>> getEventIdList(
Room room, {
int start = 0,
bool includeSending = false,
int? limit,
}) =>
runBenchmarked<List<String>>('Get event id list', () async {
// Get the synced event IDs from the store
final timelineKey = TupleKey(room.id, '').toString();
final timelineEventIds = List<String>.from(
(await _timelineFragmentsBox.get(timelineKey)) ?? []);
// Get the local stored SENDING events from the store
late final List<String> sendingEventIds;
if (!includeSending) {
sendingEventIds = [];
} else {
final sendingTimelineKey = TupleKey(room.id, 'SENDING').toString();
sendingEventIds = List<String>.from(
(await _timelineFragmentsBox.get(sendingTimelineKey)) ?? []);
}
// Combine those two lists while respecting the start and limit parameters.
final eventIds = sendingEventIds + timelineEventIds;
if (limit != null && eventIds.length > limit) {
eventIds.removeRange(limit, eventIds.length);
}
return eventIds;
});