pmvvm library
Classes
-
ChangeNotifierProvider<
T extends ChangeNotifier?> - Listens to a ChangeNotifier, expose it to its descendants and rebuilds dependents whenever ChangeNotifier.notifyListeners is called.
-
ChangeNotifierProxyProvider<
T, R extends ChangeNotifier?> - A ChangeNotifierProvider that builds and synchronizes a ChangeNotifier with external values.
-
ChangeNotifierProxyProvider0<
R extends ChangeNotifier?> - A ChangeNotifierProvider that builds and synchronizes a ChangeNotifier with external values.
-
ChangeNotifierProxyProvider2<
T, T2, R extends ChangeNotifier?> - A ChangeNotifierProvider that builds and synchronizes a ChangeNotifier with external values.
-
ChangeNotifierProxyProvider3<
T, T2, T3, R extends ChangeNotifier?> - A ChangeNotifierProvider that builds and synchronizes a ChangeNotifier with external values.
-
ChangeNotifierProxyProvider4<
T, T2, T3, T4, R extends ChangeNotifier?> - A ChangeNotifierProvider that builds and synchronizes a ChangeNotifier with external values.
-
ChangeNotifierProxyProvider5<
T, T2, T3, T4, T5, R extends ChangeNotifier?> - A ChangeNotifierProvider that builds and synchronizes a ChangeNotifier with external values.
-
ChangeNotifierProxyProvider6<
T, T2, T3, T4, T5, T6, R extends ChangeNotifier?> - A ChangeNotifierProvider that builds and synchronizes a ChangeNotifier with external values.
-
Consumer<
T> - Obtains Provider<T> from its ancestors and passes its value to builder.
-
Consumer2<
A, B> - Obtains Provider<T> from its ancestors and passes its value to builder.
-
Consumer3<
A, B, C> - Obtains Provider<T> from its ancestors and passes its value to builder.
-
Consumer4<
A, B, C, D> - Obtains Provider<T> from its ancestors and passes its value to builder.
-
Consumer5<
A, B, C, D, E> - Obtains Provider<T> from its ancestors and passes its value to builder.
-
Consumer6<
A, B, C, D, E, F> - Obtains Provider<T> from its ancestors and passes its value to builder.
-
DeferredInheritedProvider<
T, R> - An InheritedProvider where the object listened is not the object emitted.
-
FutureProvider<
T> -
Listens to a Future and exposes its result to
child
and its descendants. -
Hook<
R> - Hook is similar to a StatelessWidget, but is not associated to an Element.
- HookBuilder
-
A HookWidget that delegates its
build
to a callback. -
HookState<
R, T extends Hook< R> > - The logic and internal state for a HookWidget
-
HookView<
T extends ViewModel> - An implementation for the view that allows you to use hook widgets.
- HookWidget
- A Widget that can use a Hook.
-
InheritedContext<
T> - A BuildContext associated to an InheritedProvider.
-
InheritedProvider<
T> - A generic implementation of an InheritedWidget.
-
ListenableProvider<
T extends Listenable?> - Listens to a Listenable, expose it to its descendants and rebuilds dependents whenever the listener emits an event.
-
ListenableProxyProvider<
T, R extends Listenable?> - A variation of ListenableProvider that builds its value from values obtained from other providers.
-
ListenableProxyProvider0<
R extends Listenable?> - A variation of ListenableProvider that builds its value from values obtained from other providers.
-
ListenableProxyProvider2<
T, T2, R extends Listenable?> - A variation of ListenableProvider that builds its value from values obtained from other providers.
-
ListenableProxyProvider3<
T, T2, T3, R extends Listenable?> - A variation of ListenableProvider that builds its value from values obtained from other providers.
-
ListenableProxyProvider4<
T, T2, T3, T4, R extends Listenable?> - A variation of ListenableProvider that builds its value from values obtained from other providers.
-
ListenableProxyProvider5<
T, T2, T3, T4, T5, R extends Listenable?> - A variation of ListenableProvider that builds its value from values obtained from other providers.
-
ListenableProxyProvider6<
T, T2, T3, T4, T5, T6, R extends Listenable?> - A variation of ListenableProvider that builds its value from values obtained from other providers.
- MultiProvider
- A provider that merges multiple providers into a single linear widget tree. It is used to improve readability and reduce boilerplate code of having to nest multiple layers of providers.
-
MVVM<
T extends ViewModel> - The MVVM builder widget.
-
ObjectRef<
T> - A class that stores a single value.
-
Observable<
T> - A data wrapper class that helps with keep track of any actions applied to any data/state, it can also store a history of all actions applied to this data.
-
ObservableAction<
T> - A class that wraps the observable's action, value, time, and the observable alias value
- PMVVMConfig
- A global config class for the the PMVVM package
-
Provider<
T> -
A Provider that manages the lifecycle of the value it provides by
delegating to a pair of Create and
Dispose
. - ProviderBinding
-
ProxyProvider<
T, R> - A provider that builds a value based on other providers.
-
ProxyProvider0<
R> - A provider that builds a value based on other providers.
-
ProxyProvider2<
T, T2, R> - A provider that builds a value based on other providers.
-
ProxyProvider3<
T, T2, T3, R> - A provider that builds a value based on other providers.
-
ProxyProvider4<
T, T2, T3, T4, R> - A provider that builds a value based on other providers.
-
ProxyProvider5<
T, T2, T3, T4, T5, R> - A provider that builds a value based on other providers.
-
ProxyProvider6<
T, T2, T3, T4, T5, T6, R> - A provider that builds a value based on other providers.
- ReassembleHandler
- If you need your provider to be notified when 'Hot Reload' occurs, use this class
-
Selector<
A, S> - An equivalent to Consumer that can filter updates by selecting a limited amount of values and prevent rebuild if they don't change.
-
Selector0<
T> - A base class for custom Selector.
-
Selector2<
A, B, S> - An equivalent to Consumer that can filter updates by selecting a limited amount of values and prevent rebuild if they don't change.
-
Selector3<
A, B, C, S> - An equivalent to Consumer that can filter updates by selecting a limited amount of values and prevent rebuild if they don't change.
-
Selector4<
A, B, C, D, S> - An equivalent to Consumer that can filter updates by selecting a limited amount of values and prevent rebuild if they don't change.
-
Selector5<
A, B, C, D, E, S> - An equivalent to Consumer that can filter updates by selecting a limited amount of values and prevent rebuild if they don't change.
-
Selector6<
A, B, C, D, E, F, S> - An equivalent to Consumer that can filter updates by selecting a limited amount of values and prevent rebuild if they don't change.
- StatefulHookWidget
- A StatefulWidget that can use a Hook.
-
StatelessView<
T extends ViewModel> - The view of the MVVM architecture.
-
Store<
State, Action> - A store of mutable state that allows mutations by dispatching actions.
-
StreamProvider<
T> -
Listens to a Stream and exposes its content to
child
and descendants. -
ValueListenableProvider<
T> - Listens to a ValueListenable and exposes its current value.
- ViewModel
Mixins
- HookElement
- An Element that uses a HookWidget as its configuration.
Extensions
- ObjectExtension
- ProviderExtensions
- ReadContext
- Exposes the read method.
- SelectContext
-
Adds a
select
method on BuildContext. - WatchContext
- Exposes the watch method.
Constants
- useTextEditingController → const _TextEditingControllerHookCreator
-
Creates a TextEditingController, either via an initial text or an initial
TextEditingValue.
_TextEditingControllerHookCreator()
Properties
- debugHotReloadHooksEnabled ↔ bool
-
Whether to behave like in release mode or allow hot-reload for hooks.
getter/setter pair
Functions
-
use<
R> (Hook< R> hook) → R - Registers a Hook and returns its value.
-
useAnimation<
T> (Animation< T> animation) → T - Subscribes to an Animation and returns its value.
-
useAnimationController(
{Duration? duration, Duration? reverseDuration, String? debugLabel, double initialValue = 0, double lowerBound = 0, double upperBound = 1, TickerProvider? vsync, AnimationBehavior animationBehavior = AnimationBehavior.normal, List< Object?> ? keys}) → AnimationController - Creates an AnimationController and automatically disposes it when necessary.
-
useAppLifecycleState(
) → AppLifecycleState? - Returns the current AppLifecycleState value and rebuilds the widget when it changes.
-
useAutomaticKeepAlive(
{bool wantKeepAlive = true}) → void - Mark a widget using this hook as needing to stay alive even when it's in a lazy list that would otherwise remove it.
-
useCallback<
T extends Function> (T callback, List< Object?> keys) → T - Cache a function across rebuilds based on a list of keys.
-
useContext(
) → BuildContext - Obtains the BuildContext of the building HookWidget.
-
useEffect(
Dispose? effect(), [List< Object?> ? keys]) → void - Useful for side-effects and optionally canceling them.
-
useFocusNode(
{String? debugLabel, FocusOnKeyCallback? onKey, FocusOnKeyEventCallback? onKeyEvent, bool skipTraversal = false, bool canRequestFocus = true, bool descendantsAreFocusable = true}) → FocusNode - Creates an automatically disposed FocusNode.
-
useFocusScopeNode(
{String? debugLabel, FocusOnKeyCallback? onKey, FocusOnKeyEventCallback? onKeyEvent, bool skipTraversal = false, bool canRequestFocus = true}) → FocusScopeNode - Creates an automatically disposed FocusScopeNode.
-
useFuture<
T> (Future< T> ? future, {T? initialData, bool preserveState = true}) → AsyncSnapshot<T> - Subscribes to a Future and returns its current state as an AsyncSnapshot.
-
useIsMounted(
) → IsMounted - Returns an IsMounted object that you can use to check if the State is mounted.
-
useListenable<
T extends Listenable?> (T listenable) → T - Subscribes to a Listenable and marks the widget as needing build whenever the listener is called.
-
useListenableSelector<
R> (Listenable listenable, R selector()) → R - Rebuild only when there is a change in the selector result.
-
useMemoized<
T> (T valueBuilder(), [List< Object?> keys = const <Object>[]]) → T - Caches the instance of a complex object.
-
useOnAppLifecycleStateChange(
LifecycleCallback? onStateChanged) → void - Listens to the AppLifecycleState.
-
useOnPlatformBrightnessChange(
BrightnessCallback onBrightnessChange) → void - Listens to the platform Brightness.
-
usePageController(
{int initialPage = 0, bool keepPage = true, double viewportFraction = 1.0, List< Object?> ? keys}) → PageController - Creates a PageController that will be disposed automatically.
-
usePlatformBrightness(
) → Brightness - Returns the current platform Brightness value and rebuilds the widget when it changes.
-
usePrevious<
T> (T val) → T? -
Returns the previous value passed to usePrevious (from the previous widget
build
). -
useReassemble(
VoidCallback callback) → void -
Runs the callback on every hot reload,
similar to
reassemble
in the stateful widgets. -
useReducer<
State, Action> (Reducer< State, Action> reducer, {required State initialState, required Action initialAction}) → Store<State, Action> - An alternative to useState for more complex states.
-
useRef<
T> (T initialValue) → ObjectRef< T> - Creates an object that contains a single mutable property.
-
useScrollController(
{double initialScrollOffset = 0.0, bool keepScrollOffset = true, String? debugLabel, List< Object?> ? keys}) → ScrollController - Creates ScrollController that will be disposed automatically.
-
useSingleTickerProvider(
{List< Object?> ? keys}) → TickerProvider - Creates a single usage TickerProvider.
-
useState<
T> (T initialData) → ValueNotifier< T> - Creates a variable and subscribes to it.
-
useStream<
T> (Stream< T> ? stream, {T? initialData, bool preserveState = true}) → AsyncSnapshot<T> - Subscribes to a Stream and returns its current state as an AsyncSnapshot.
-
useStreamController<
T> ({bool sync = false, VoidCallback? onListen, VoidCallback? onCancel, List< Object?> ? keys}) → StreamController<T> - Creates a StreamController which is automatically disposed when necessary.
-
useTabController(
{required int initialLength, TickerProvider? vsync, int initialIndex = 0, List< Object?> ? keys}) → TabController - Creates a TabController that will be disposed automatically.
-
useTransformationController(
{Matrix4? initialValue, List< Object?> ? keys}) → TransformationController - Creates and disposes a TransformationController.
-
useValueChanged<
T, R> (T value, R? valueChange(T oldValue, R? oldResult)) → R? - Watches a value and triggers a callback whenever the value changed.
-
useValueListenable<
T> (ValueListenable< T> valueListenable) → T - Subscribes to a ValueListenable and returns its value.
-
useValueNotifier<
T> (T initialData, [List< Object?> ? keys]) → ValueNotifier<T> - Creates a ValueNotifier that is automatically disposed.
Typedefs
-
BrightnessCallback
= FutureOr<
void> Function(Brightness previous, Brightness current) - A callback triggered when the platform brightness changes.
-
Create<
T> = T Function(BuildContext context) -
A function that creates an object of type
T
. -
DeferredStartListening<
T, R> = VoidCallback Function(InheritedContext< R?> context, void setState(R value), T controller, R? value) -
A callback used to handle the subscription of
controller
. - Dispose = void Function()
- A function called when the state of a widget is destroyed.
-
ErrorBuilder<
T> = T Function(BuildContext context, Object? error) - A callback used to build a valid value from an error.
- IsMounted = bool Function()
- Used by useIsMounted to allow widgets to determine if the Widget is still in the widget tree or not.
-
LifecycleCallback
= FutureOr<
void> Function(AppLifecycleState? previous, AppLifecycleState current) - A callback triggered when the app life cycle changes.
-
Locator
= T Function<
T>() - A generic function that can be called to read providers, without having a reference on BuildContext.
-
ProviderBuilder<
R> = Widget Function(BuildContext context, R value, Widget child) -
ProxyProviderBuilder<
T, R> = R Function(BuildContext context, T value, R? previous) -
ProxyProviderBuilder2<
T, T2, R> = R Function(BuildContext context, T value, T2 value2, R? previous) -
ProxyProviderBuilder3<
T, T2, T3, R> = R Function(BuildContext context, T value, T2 value2, T3 value3, R? previous) -
ProxyProviderBuilder4<
T, T2, T3, T4, R> = R Function(BuildContext context, T value, T2 value2, T3 value3, T4 value4, R? previous) -
ProxyProviderBuilder5<
T, T2, T3, T4, T5, R> = R Function(BuildContext context, T value, T2 value2, T3 value3, T4 value4, T5 value5, R? previous) -
ProxyProviderBuilder6<
T, T2, T3, T4, T5, T6, R> = R Function(BuildContext context, T value, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, R? previous) -
Reducer<
State, Action> = State Function(State state, Action action) -
Composes an
Action
and aState
to create a newState
. -
ShouldRebuild<
T> = bool Function(T previous, T next) - Used by providers to determine whether dependents needs to be updated when the value exposed changes
-
StartListening<
T> = VoidCallback Function(InheritedContext< T?> element, T value) - A callback used to start the listening of an object and return a function that cancels the subscription.
-
UpdateShouldNotify<
T> = bool Function(T previous, T current) -
A function that returns true when the update from
previous
tocurrent
should notify listeners, if any. -
ValueChangedCallback<
T> = void Function(ObservableAction< T> newAction, ObservableAction<T> ? prevAction)
Exceptions / Errors
- ProviderNotFoundException
- The error that will be thrown if Provider.of fails to find a Provider as an ancestor of the BuildContext used.
- ProviderNullException
-
Called
Provider.of<T>
instead ofProvider.of<T?>
but the provider returnednull
.