createState method

  1. @override
HookState<void, Hook<void>> createState()
override

Creates the mutable state for this Hook linked to its widget creator.

Subclasses should override this method to return a newly created instance of their associated State subclass:

@override
HookState createState() => _MyHookState();

The framework can call this method multiple times over the lifetime of a HookWidget. For example, if the hook is used multiple times, a separate HookState must be created for each usage.

Implementation

@override
HookState<void, Hook<void>> createState() => LifecycleHookState();