queryEvents method
Queries historical events from the event log.
filter specifies the criteria for selecting events (channel, time range,
event IDs, levels, etc.).
Returns a list of EventRecord objects matching the filter criteria.
Throws EventLogException if the query fails.
Implementation
@override
Future<List<EventRecord>> queryEvents(EventFilter filter) async {
try {
final result = await methodChannel.invokeMethod<List>(
'queryEvents',
filter.toMap(),
);
if (result == null) return [];
return result
.cast<Map>()
.map((map) => EventRecord.fromMap(Map<String, dynamic>.from(map)))
.toList();
} on PlatformException catch (e) {
throw _handlePlatformException(e);
}
}