SoloSubscription class final

A listener registered on a Listenable, and the way to take it back.

The plain way needs the callback kept somewhere so that Listenable.removeListener can be given the same object back:

void _listener() {}

controller.addListener(_listener);
controller.removeListener(_listener);

A subscription holds it instead, so a closure works as well as a method and the listening ends where the object goes:

final subscription = controller.listen(() => print(controller.value));
subscription.cancel();

Properties

hashCode → int
The hash code for this object.
no setterinherited
isCancelled → bool
Whether cancel has been called.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addTo(SoloSubscriptions subscriptions) → void
Puts this subscription into subscriptions.
cancel() → void
Takes the listener back; calling it again does nothing.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited