utopia_hooks library

Mixins

ComputedStateMixin<T>
DelegateListenableValue<T, D>
HookContextMixin
Mixin with common parts of HookContext implementations.
HookContextStateMixin<W extends StatefulWidget>
HookStateDiagnosticableMixin<T, H extends Hook<T>>
A mixin that provides default implementation for Diagnosticable for HookState.

Functions

use<T>(Hook<T> hook) → T
Register hook in the current HookContext and return its value.
useAnimationController({Duration? duration, Duration? reverseDuration, String? debugLabel, double initialValue = 0, double lowerBound = 0, double upperBound = 1, TickerProvider? vsync, AnimationBehavior animationBehavior = AnimationBehavior.normal}) AnimationController
useAppLifecycleState({void onPaused()?, void onResumed()?, void onHidden()?, void onInactive()?}) AppLifecycleState
useAsyncSnapshotErrorHandler(AsyncSnapshot<Object?>? snapshot, {void onError(Object, StackTrace)?}) → void
useAutoComputedState<T>(Future<T> compute(), {bool shouldCompute = true, HookKeys keys = const [], Duration debounceDuration = Duration.zero}) MutableComputedState<T>
Allows for automatic refreshing of ComputedState in response to changes in keys. Refreshes also on first call.
useBuildContext() BuildContext
Retrieves a BuildContext from the current HookContext.
useCombinedInitializationState(Set<Type> types) CombinedInitializationState
useComputedState<T>(Future<T> compute()) MutableComputedState<T>
useContext() HookContext
Retrieves the current HookContext.
useDebounced<T>(T value, {required Duration duration}) → T
useEffect(dynamic effect(), [HookKeys keys = const []]) → void
useFieldState({String? initialValue}) MutableFieldState
useFuture<T>(Future<T>? future, {T? initialData, bool preserveState = true}) AsyncSnapshot<T>
useFutureData<T>(Future<T?> future, {T? initialData, bool preserveState = true, void onError(Object, StackTrace)?}) → T?
useGenericFieldState<T>({required T initialValue}) MutableGenericFieldState<T>
useIf(bool condition, void block()) → void
useImmediateEffect(dynamic effect(), [HookKeys keys = const []]) → void
useIsMounted() IsMounted
useListenable(Listenable? listenable, {bool shouldRebuild()?}) → void
useListenableListener(Listenable? listenable, void block()) → void
useListenableValue<T>(ListenableValue<T> listenable, {bool shouldRebuild(T prev, T curr)?}) → T
useListenableValueListener<T>(ListenableValue<T>? listenable, void block(T)) → void
useMap<K extends Object, T>(Set<K> keys, T block(K)) Map<K, T>
useMemoized<T>(T block(), [HookKeys keys = const [], void dispose(T)?]) → T
useMemoizedFuture<T>(Future<T> block(), {T? initialData, bool preserveState = true, HookKeys keys = const []}) AsyncSnapshot<T>
useMemoizedFutureData<T>(Future<T> block(), {T? initialData, bool preserveState = true, void onError(Object, StackTrace)?, HookKeys keys = const []}) → T?
useMemoizedIf<T>(bool condition, T block(), [HookKeys keys = const []]) → T?
useMemoizedStream<T>(Stream<T> block(), {T? initialData, bool preserveState = true, HookKeys keys = const []}) AsyncSnapshot<T>
useMemoizedStreamData<T>(Stream<T> block(), {T? initialData, bool preserveState = true, void onError(Object, StackTrace)?, HookKeys keys = const []}) → T?
usePeriodicalSignal({required Duration period, bool enabled = true}) int
usePersistedState<T extends Object>(Future<T?> get(), Future<void> set(T? value), {bool canGet = true, HookKeys getKeys = const []}) PersistedState<T>
usePrevious<T>(T value) → T?
usePreviousIfNull<T>(T? value) → T?
useProvided<T>() → T
Retrieves a provided value of type T and registers it as a dependency of the current HookContext.
useProvidedUnsafe(Type type) → dynamic
Retrieves a provided value assigned to type and registers it as a dependency of the current HookContext.
useRef<T>(T initialValue) ListenableMutableValue<T>
useSingleTickerProvider() TickerProvider
useState<T>(T initialValue, {bool listen = true}) ListenableMutableValue<T>
useStream<T>(Stream<T>? stream, {T? initialData, bool preserveState = true}) AsyncSnapshot<T>
useStreamController<T>() StreamController<T>
useStreamData<T>(Stream<T>? stream, {T? initialData, bool preserveState = true, void onError(Object error, StackTrace stackTrace)?}) → T?
useStreamSubscription<T>(Stream<T>? stream, void block(T), {void onError(Object, StackTrace)?, void onDone()?}) → void
useSubmitState() MutableSubmitState
useValueChanged<T, R>(T value, R? valueChange(T oldValue, R? oldResult)) → R?
useValueListenable<T>(ValueListenable<T> listenable, {bool shouldRebuild(T prev, T curr)?}) → T
useValueListenableListener<T>(ValueListenable<T>? listenable, void block(T)) → void
useValueWrapper<T>(T value) Value<T>
useWithSelf<T extends Object>(T block(Value<T> self)) → T

Exceptions / Errors

ProvidedValueNotFoundException
An exception thrown by ProviderContext.getUnsafe when the requested value can't be provided.