events method
Listens for logs emitted from transactions. The options
can be used to
apply additional filters.
The stream can only be listened to once. The subscription must be disposed properly when no longer used. Failing to do so causes a memory leak in your application and uses unnecessary resources on the connected node. See also:
- https://solidity.readthedocs.io/en/develop/contracts.html#events, which explains more about how events are encoded.
Implementation
Stream<FilterEvent> events(FilterOptions options) {
if (socketConnector != null) {
// The real-time rpc nodes don't support listening to old data, so handle
// that here.
return Stream.fromFuture(getLogs(options))
.expand((e) => e)
.followedBy(_filters.addFilter(_EventFilter(options)));
}
return _filters.addFilter(_EventFilter(options));
}