addOnStateChangedListener method Null safety
- dynamic onStateChanged(
- List<
EmpireStateChanged> events
- List<
Adds an event handler which gets executed each time an EmpireProperty value is changed.
If your listener references a BuildContext inside of a Widget, you should override the Widget dispose method and cancel the subscription.
Implementation
StreamSubscription addOnStateChangedListener(
Function(List<EmpireStateChanged> events) onStateChanged) {
final newSubscription = _stateController.stream.listen(onStateChanged);
_subscriptions.add(newSubscription);
return newSubscription;
}