hooks library

Classes

ReducerHook<TState, TAction, TInit>
The return value of useReducer.
StateHook<T>
The return value of useState.

Functions

useCallback<T extends Function>(T callback, List dependencies) → T
Returns a memoized version of callback that only changes if one of the dependencies has changed.
useContext<T>(Context<T> context) → T
Returns the value of the nearest Context.Provider for the provided context object every time that context is updated.
useDebugValue<T>(T value, [dynamic format(T)?]) → dynamic
Displays value as a label for a custom hook in React DevTools.
useEffect(dynamic sideEffect(), [List<Object?>? dependencies]) → void
Runs sideEffect after every completed render of a DartFunctionComponent.
useImperativeHandle(dynamic ref, dynamic createHandle(), [List? dependencies]) → void
Customizes the ref value that is exposed to parent components when using forwardRef2 by setting ref.current to the return value of createHandle.
useLayoutEffect(dynamic sideEffect(), [List<Object?>? dependencies]) → void
Runs sideEffect synchronously after a DartFunctionComponent renders, but before the screen is updated.
useMemo<T>(T createFunction(), [List? dependencies]) → T
Returns a memoized version of the return value of createFunction.
useReducer<TState, TAction, TInit>(TState reducer(TState state, TAction action), TState initialState) ReducerHook<TState, TAction, TInit>
Initializes state of a DartFunctionComponent to initialState and creates a dispatch method.
useReducerLazy<TState, TAction, TInit>(TState reducer(TState state, TAction action), TInit initialArg, TState init(TInit)) ReducerHook<TState, TAction, TInit>
Initializes state of a DartFunctionComponent to init(initialArg) and creates dispatch method.
useRef<T>([T? initialValue]) Ref<T?>
Returns an empty mutable Ref object.
useRefInit<T>(T initialValue) Ref<T>
Returns a mutable Ref object with Ref.current property initialized to initialValue.
useState<T>(T initialValue) StateHook<T>
Adds local state to a DartFunctionComponent by returning a StateHook with StateHook.value initialized to initialValue.
useStateLazy<T>(T init()) StateHook<T>
Adds local state to a DartFunctionComponent by returning a StateHook with StateHook.value initialized to the return value of init.