addSubscription method
Register a subscription
that should be canceled when the component unmounts.
Cancellation will be handled automatically by componentWillUnmount
.
Implementation
void addSubscription(StreamSubscription subscription) {
_subscriptions.add(subscription);
}