update method

  1. @override
  2. @mustCallSuper
void update(
  1. double t
)
@mustCallSuper, override

This implementation of update updates every component in the list.

It also actually adds the components that were added by the addLater method, and remove those that are marked for destruction via the Component.destroy method. You can override it further to add more custom behaviour.

Implementation

@override
@mustCallSuper
void update(double t) {
  _removeLater.forEach((c) => components.remove(c));
  _removeLater.clear();

  components.addAll(_addLater);
  _addLater.clear();

  components.forEach((c) => c.update(t));
  components.removeWhere((c) => c.destroy()).forEach((c) => c.onDestroy());
}