StreamSnackbarController class
Handle to a snackbar that has been enqueued or is currently visible.
Returned from StreamSnackbarMessenger.show. Use closed to await dismissal and close to dismiss programmatically.
{@tool snippet}
Awaiting the dismissal reason:
final controller = StreamSnackbarMessenger.of(context).show(
const StreamSnackbar(
message: Text('Message deleted'),
action: StreamSnackbarAction(label: Text('Undo'), onPressed: undo),
),
);
if (await controller.closed == StreamSnackbarClosedReason.timeout) {
commitDelete();
}
{@end-tool}
See also:
- StreamSnackbarMessenger.show, which returns a controller.
- StreamSnackbarClosedReason, the value yielded by closed.
Properties
-
closed
→ Future<
StreamSnackbarClosedReason> -
A future that resolves when this snackbar finishes.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
[StreamSnackbarClosedReason reason = StreamSnackbarClosedReason.dismiss]) → void - Programmatically dismisses this snackbar.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited