NetworkGuardButton class

A tap target that guards against duplicate taps and offline submissions.

Wraps onPressed with deduplication (rapid double-taps only run the action once) and disables itself while offline or while a previous tap's action is still running. Fully custom UI via builder; if omitted, a minimal default (child + reduced opacity while disabled) is used.

Inheritance

Constructors

NetworkGuardButton({Key? key, required Future<void> onPressed(), Widget? child, NetworkButtonBuilder? builder, String? dedupeKey})
Creates a NetworkGuardButton.
const

Properties

builder NetworkButtonBuilder?
A fully custom builder. Overrides child if provided.
final
child Widget?
Simple child shown by the default builder.
final
dedupeKey String?
Deduplication key for concurrent taps. Defaults to a key unique to this widget instance, so taps on this button are deduplicated among themselves without needing to be told a key.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onPressed Future<void> Function()
The action to run on tap. Not called again while a previous call is still in flight (see dedupeKey).
final
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<NetworkGuardButton>
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