flutter_hooks library

Classes

Hook<R>
Hook is similar to a StatelessWidget, but is not associated to an Element. [...]
HookBuilder
A HookWidget that defer its HookWidget.build to a callback
HookElement
An Element that uses a HookWidget as its configuration.
HookState<R, T extends Hook<R>>
The logic and internal state for a HookWidget
HookWidget
A Widget that can use Hook [...]
Store<State, Action>
A state holder that allows mutations by dispatching actions.

Constants

useTextEditingController → const _TextEditingControllerHookCreator
Creates a TextEditingController, either via an initial text or an initial TextEditingValue. [...]
const _TextEditingControllerHookCreator()

Properties

debugHotReloadHooksEnabled ↔ bool
Wether to behave like in release mode or allow hot-reload for hooks. [...]
read / write

Functions

useAnimation<T>(Animation<T> animation) → T
Subscribes to an Animation and return its value. [...]
useAnimationController({Duration duration, String debugLabel, double initialValue: 0, double lowerBound: 0, double upperBound: 1, TickerProvider vsync, AnimationBehavior animationBehavior: AnimationBehavior.normal, List<Object> keys }) AnimationController
Creates an AnimationController automatically disposed. [...]
useContext() BuildContext
Obtain the BuildContext of the building HookWidget.
useEffect(Dispose effect(), [ List<Object> keys ]) → void
keys is specified. In which case useEffect is called again only if any value inside keys as changed. [...]
useFuture<T>(Future<T> future, { T initialData, bool preserveState: true }) AsyncSnapshot<T>
Subscribes to a Future and return its current state in an AsyncSnapshot. [...]
useListenable<T extends Listenable>(T listenable) → T
Subscribes to a Listenable and mark the widget as needing build whenever the listener is called. [...]
useMemoized<T>(T valueBuilder(), [ List<Object> keys = const [] ]) → T
Cache the instance of a complex object. [...]
usePrevious<T>(T val) → T
Returns the previous argument called to usePrevious.
useReassemble(VoidCallback callback) → void
Runs the callback on every hot reload similar to reassemble in the Stateful widgets [...]
useReducer<State extends Object, Action>(Reducer<State, Action> reducer, { State initialState, Action initialAction }) Store<State, Action>
An alternative to useState for more complex states. [...]
useSingleTickerProvider({List<Object> keys }) TickerProvider
Creates a single usage TickerProvider. [...]
useState<T>([T initialData ]) ValueNotifier<T>
Create variable and subscribes to it. [...]
useStream<T>(Stream<T> stream, { T initialData, bool preserveState: true }) AsyncSnapshot<T>
Subscribes to a Stream and return its current state in an AsyncSnapshot. [...]
useStreamController<T>({bool sync: false, VoidCallback onListen, VoidCallback onCancel, List<Object> keys }) → StreamController<T>
Creates a StreamController automatically disposed. [...]
useValueChanged<T, R>(T value, R valueChange(T oldValue, R oldResult)) → R
Watches a value and calls a callback whenever the value changed. [...]
useValueListenable<T>(ValueListenable<T> valueListenable) → T
Subscribes to a ValueListenable and return its value. [...]
useValueNotifier<T>([T intialData, List<Object> keys ]) ValueNotifier<T>
Creates a ValueNotifier automatically disposed. [...]

Typedefs

Dispose() → void
Useful for side-effects and optionally canceling them. [...]
Reducer<State, Action>(State state, Action action) → State
Composes an Action and a State to create a new State. [...]