fetcher_bloc library

Classes

ActivityBarrier
A widget that add an activity indicator overlay that prevents the user from interacting with widgets behind itself.
AsyncEditBuilder<T>
A widget that allow to fetch a value asynchronously, and then to run another task asynchronously (to submit new value for instance) while updating UI with new value. Handle all states (loading, errors, onSuccess). It's actually a mix of FetchBuilder and SubmitBuilder combined. Typically used for component that needs to fetch a value and then edit that value. DON'T use this if fetch and submit tasks are not related (prefer using separate FetchBuilder and SubmitBuilder). Example : an async switch, that fetch the current value, and then can submit the new value. Use FetcherConfig.fetchingBuilder (while fetching) and FetcherConfig.submittingBuilder (while submitting) on config to customize each loading widget independently.
ClearFocusBackground
DataStream<T>
A broadcast Stream with access to the latest emitted value. Does explicitly NOT handle errors to provide a direct and simple access to the value.
DataStreamBuilder<T>
Widget that builds itself based on the latest value a DataStream.
DefaultFetcherConfig
Provides a default FetcherConfig to all fetcher widgets below it.
EditingScope
Tracks elements being edited in its subtree (e.g. a GuardedForm with changes). May be used to delay a data update while user is editing, so that the input isn't lost when the subtree is recreated. GuardedForm (and so SubmitFormBuilder) automatically registers to the closest EditingScope when changed. Nested scopes are supported: an element being edited also marks all ancestor scopes as editing. Must be placed above the subtree that may be recreated. Parent scope is resolved once: moving a scope or a GuardedForm to another place in the tree (with a GlobalKey) isn't supported.
EditingScopeState
EditingValueBuilder<T>
Builds builder with value, recreating its subtree (its state is lost) each time value changes, except while an element is being edited in it (see EditingScope): the displayed value is then kept, and updated to the latest value when editing ends. Values are compared with ==: a subtree won't be recreated after a save if the new value equals the previous one. Inside a FetchBuilder or EventFetchBuilder, keep FetcherConfig.fadeOnDataChange to false (default): otherwise this widget is recreated on each data and can't keep the displayed value. Loading and error states also replace this widget (e.g. stream error, refresh with clearDataFirst).
EventFetchBuilder<T>
Widget that listen to an EventStream and display data. It's like FetchBuilder but instead of directly calling a task once, it will listen to a stream and his updates. Handle all possible states: loading, loaded, errors.
EventSnapshot<T>
EventStream<T>
A broadcast Stream with access to the latest emitted value, with error handling.
EventStreamBuilder<T>
Widget that builds itself based on the latest value a EventStream.
FetchBuilder<T>
Widget that fetch data asynchronously, and display it when available. Handle all possible states: loading, loaded, errors.
FetchBuilderController<R>
FetchBuilderControllerBase<T, R>
A controller for an FetchBuilder.
FetchBuilderWithParameter<T, R>
A FetchBuilder where the refresh method of the controller takes a parameter, passed to task. Useful for advanced use cases.
FetchBuilderWithParameterController<T, R>
FetcherConfig
Configuration for fetcher widgets.
FetchErrorData
Fetch error data
FetchRefresher
A widget that supports the Material "swipe to refresh" idiom (a.k.a pull-to-refresh) for FetchBuilder. When triggered, will automatically call FetchBuilderControllerBase.refresh for all FetchBuilder children.
FetchRefresherController
A controller for an FetchRefresher.
FillRemainsScrollView
GuardedForm
A Form that tracks for changes and may prevent pop. Current implementation just track if form has been modified once (calling Form.save() doesn't reset status). Call markAsSaved to reset status (automatically done by SubmitFormBuilder on success). When changed, registers to the closest EditingScope, until saved or disposed.
PagedData<T, P>
PagedListViewFetcher<T, P>
A widget that fetch a paginated list of data, page by page. Handle all states (loading, errors, onSuccess). Initially just fetch first page, then fetch next page when user scrolls. T is the type of the data. P is the type of the pageId (usually String or int).
SubmitBuilder<T>
A widget that allow to run an async task and handle all states (loading, errors, onSuccess). Design for tasks that is triggered by a user action (like a button press).
SubmitFormBuilder<T>
Wrapper around SubmitBuilder with automatic form validation.
ValueStream<T>
Abstract base class for a broadcast Stream with access to the latest emitted value.

Mixins

BlocProvider<S extends StatefulWidget, T extends Disposable>
Mixin that provides a bloc field that contains a bloc instance.
Disposable

Functions

isNullable<T>() → bool
Whether the specified type is nullable.
scrollToFirstInvalidField(BuildContext formContext) → void
Scrolls to the first invalid FormField in the subtree rooted at formContext. Must be called after Form.validate so that FormFieldState.hasError is up to date.

Typedefs

DataEditWidgetBuilder<T> = Widget Function(BuildContext context, T value, ValueSetter<T> submit)
DataWidgetBuilder<T> = Widget Function(BuildContext context, T value)
Signature for strategies that build widgets based on provided data
ParameterizedAsyncTask<T, R> = FutureOr<R> Function(T? param)
Task used by fetcher widgets to fetch data. May return the value directly (not a Future) to skip the loader: see FetchBuilder.
SubmitChildBuilder<T> = Widget Function(BuildContext context, TaskRunnerCallback<T> runTask)
TaskRunnerCallback<T> = void Function([AsyncValueGetter<T>? task])