update method

  1. @override
void update(
  1. Subject<State> subject,
  2. State state
)
override

This method is called whenever there is a change in the state of the Subject.

  • subject - A reference to the subject object that triggered the update.
  • state - The new state information provided by the subject.

Implementations of the Observer class should provide an implementation of the update() method to perform actions with the new state information provided.

Implementation

@override
void update(Subject<State> subject, State state) {
  super.update(subject, state);
  _controller.add(state);
}