I am listening for click events like this:
element.onClick.listen((e) => doCoolStuff());
How do I stop listening?
Because onClick
returns a StreamSubscription, you can cancel()
it to stop receiving events.
Here is an example:
import 'dart:async';
// ...
var subscription = element.onClick.listen((e) => doCoolStuff());
// later
subscription.cancel();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With