getLogs method
Returns the List of Log matching the filter
.
Keep in mind that many backends will discard old events, and that requests which are too broad may get dropped as they require too many resources to execute the query.
// Create new BUSD BEP20 Token filter for specific topics
final filter = Filter(
address: '0xe9e7cea3dedca5984780bafc599bd69add087d56',
topics: [
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
'0x0000000000000000000000002caa4694cb7daf7d49a198dc1103c06d4991ae52',
],
);
// Query logs for specified filter
final logs = await provider!.getLogs(filter);
print(logs.length); // 8
print(logs.first); // Log: 3 topics from 0x2ad2e409
print(logs.first is Log); // true
Implementation
Future<List<Log>> getLogs(EventFilter filter) async =>
(await call<List>('getLogs', [filter.impl]))
.cast<_LogImpl>()
.map((e) => Log._(e))
.toList();