dependOnHooks method

void dependOnHooks(
  1. List<ReactterHook> hooks
)

Implementation

void dependOnHooks(List<ReactterHook> hooks) {
  for (int i = 0; i < hooks.length; i++) {
    final hook = hooks[i];

    void _onDidUpdate(_, __) => markNeedsBuild();

    UseEvent.withInstance(hook).on(Lifecycle.didUpdate, _onDidUpdate);

    _unsubscribersDependencies.add(
      () =>
          UseEvent.withInstance(hook).off(Lifecycle.didUpdate, _onDidUpdate),
    );
  }
}