SnackBarClosedReason enum Null safety

Specify how a SnackBar was closed.

The ScaffoldMessengerState.showSnackBar function returns a ScaffoldFeatureController. The value of the controller's closed property is a Future that resolves to a SnackBarClosedReason. Applications that need to know how a snackbar was closed can use this value.

Example:

ScaffoldMessenger.of(context).showSnackBar(
  SnackBar( ... )
).closed.then((SnackBarClosedReason reason) {
   ...
});
Inheritance

Constructors

SnackBarClosedReason()
const

Values

action → const SnackBarClosedReason

The snack bar was closed after the user tapped a SnackBarAction.

SnackBarClosedReason()
dismiss → const SnackBarClosedReason

The snack bar was closed through a SemanticsAction.dismiss.

SnackBarClosedReason()
swipe → const SnackBarClosedReason

The snack bar was closed by a user's swipe.

SnackBarClosedReason()
hide → const SnackBarClosedReason

The snack bar was closed by the ScaffoldFeatureController close callback or by calling ScaffoldMessengerState.hideCurrentSnackBar directly.

SnackBarClosedReason()
remove → const SnackBarClosedReason

The snack bar was closed by an call to ScaffoldMessengerState.removeCurrentSnackBar.

SnackBarClosedReason()
timeout → const SnackBarClosedReason

The snack bar was closed because its timer expired.

SnackBarClosedReason()

Properties

hashCode int
The hash code for this object.
read-onlyinherited
index int
A numeric identifier for the enumerated value.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<SnackBarClosedReason>
A constant List of the values in this enum, in order of their declaration.
[action, dismiss, swipe, hide, remove, timeout]