AbstractFormBuilder<B extends StateStreamableSource<S> , S extends AbstractFormBaseState> class
A widget for building forms with state management and event handling. This widget integrates with AbstractFormBaseState and provides callbacks for initialization, submission, success, and error handling.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- AbstractFormBuilder
Constructors
-
AbstractFormBuilder.new({Key? key, void onInit(BuildContext context)?, bool skipInitialOnInit = false, bool reinitOnSuccess = true, bool reinitOnLocalSuccess = false, Widget errorBuilder(BuildContext context, void onInit(), S state)?, Widget loaderBuilder(BuildContext context, S state)?, bool isLoading(BuildContext context, S state)?, bool shouldAutovalidate(BuildContext context, S state)?, bool isError(BuildContext context, S state)?, bool hasData(BuildContext context, S state)?, Widget? child, Widget extendedBuilder(BuildContext context, S state, B bloc, void submit())?, Widget builder(BuildContext context, S state)?, void listener(BuildContext context, S state)?, void onSuccess(BuildContext context, S state)?, void onLocalSuccess(BuildContext context, S state)?, void onError(BuildContext context, S state)?, void onLocalError(BuildContext context, S state)?, void onValidationError(BuildContext context, S state)?, B? providerValue, B provider(BuildContext context)?, List<
SingleChildWidget> ? providers}) -
Creates an AbstractFormBuilder.
const
Properties
- builder → Widget Function(BuildContext context, S state)?
-
Builder for rendering the form based on the current state.
final
- child → Widget?
-
The child widget to display if no custom builders are provided.
final
- errorBuilder → Widget Function(BuildContext context, void onInit(), S state)?
-
Builder for displaying an error state.
Provides a callback to retry initialization.
final
- extendedBuilder → Widget Function(BuildContext context, S state, B bloc, void submit())?
-
Extended builder that provides access to the form state, bloc/cubit instance,
and a submit callback for custom form rendering.
final
- hasData → bool Function(BuildContext context, S state)?
-
Custom function to determine if the form has data.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isError → bool Function(BuildContext context, S state)?
-
Custom function to determine if the form is in an error state.
If not provided, defaults to checking if the state is
error
.final - isLoading → bool Function(BuildContext context, S state)?
-
Custom function to determine if the form is in a loading state.
If not provided, defaults to checking if the state is
initializing
.final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- listener → void Function(BuildContext context, S state)?
-
Listener for state changes. Can be used to perform side effects
based on the form's state.
final
- loaderBuilder → Widget Function(BuildContext context, S state)?
-
Builder for displaying a loading state.
final
- onError → void Function(BuildContext context, S state)?
-
Callback triggered when the form submission encounters an error.
final
- onInit → void Function(BuildContext context)?
-
Callback triggered when the form is initialized.
This can be used to perform custom initialization logic.
final
- onLocalError → void Function(BuildContext context, S state)?
-
Callback triggered when the local form submission encounters an error.
final
- onLocalSuccess → void Function(BuildContext context, S state)?
-
Callback triggered when the local form submission is successful.
final
- onSuccess → void Function(BuildContext context, S state)?
-
Callback triggered when the form submission is successful.
final
- onValidationError → void Function(BuildContext context, S state)?
-
Callback triggered when the form validation fails.
final
- provider → B Function(BuildContext context)?
-
A function to create the bloc/cubit instance. Used if
providerValue
is not provided.final -
providers
→ List<
SingleChildWidget> ? -
A list of additional providers to wrap around the form.
final
- providerValue → B?
-
The bloc/cubit instance to use. If provided, the widget will not create a new instance.
final
- reinitOnLocalSuccess → bool
-
If
true
, reinitializes the form after a successful local submission. Defaults tofalse
.final - reinitOnSuccess → bool
-
If
true
, reinitializes the form after a successful submission. Defaults totrue
.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shouldAutovalidate → bool Function(BuildContext context, S state)?
-
Custom function to determine if the form should auto-validate.
final
- skipInitialOnInit → bool
-
If
true
, skips the initialonInit
call when the widget is first built. Defaults tofalse
.final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited