addOnStateChangedListener method

StreamSubscription addOnStateChangedListener(
  1. dynamic onStateChanged(
    1. List<ActiveStateChanged> events
    )
)

Event handler for ActiveType when values get updated

If a listener references a BuildContext inside a Widget, override the Widget dispose method and cancel the subscription.

Implementation

StreamSubscription addOnStateChangedListener(
    Function(List<ActiveStateChanged> events) onStateChanged) {
  final newSubscription = _stateController.stream.listen(onStateChanged);
  _subscriptions.add(newSubscription);
  return newSubscription;
}