useState<T> method
Create a state hook
Implementation
StateHook<T> useState<T>(T initialValue, [String? name]) {
if (_hookIndex >= _hooks.length) {
// Create new hook
final hook = StateHook<T>(initialValue, name, () {
scheduleUpdate();
});
_hooks.add(hook);
}
// Get the hook (either existing or newly created)
final hook = _hooks[_hookIndex] as StateHook<T>;
_hookIndex++;
return hook;
}