AsyncButtonGroup class

Allows one pending operation at a time among descendant async buttons.

When a member's onPressed starts, that button shows loading as usual and every other member is disabled natively, blocking pointer, keyboard, and accessibility activation without showing loading content. Members recover when the operation and any onError finish. Buttons outside a group, and members with excludeFromGroup: true such as a Cancel action, are never blocked and never block others.

The nearest group applies; nested groups coordinate their own members independently. Only activations claim a group: a loading parameter or AsyncButtonController.loading request affects only its own button. An operation keeps its claim if its button is disposed, and it never releases a newer operation's claim. Removing the group releases its members. The group coordinates availability only; application code owns cancellation.

A claim belongs to the group where activation started. A button moved into another group mid-operation keeps loading but does not claim the new group, so that group's members stay available. A Future that never completes keeps its group blocked: give real work a timeout, or rebuild the group with a new Key to start a fresh one.

Inheritance

Constructors

AsyncButtonGroup({required Widget child, Key? key})
Creates a group coordinating the async buttons below child.
const

Properties

child → Widget
The subtree whose async buttons share this group.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<AsyncButtonGroup>
Creates the mutable state for this widget at a given location in the tree.
override
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

Static Methods

isActiveOf(BuildContext context) → bool
Whether a member operation is pending in the nearest group.