DialogService class

A service class to display and manage a stack of custom dialogs using SnackBar.

This service leverages a GlobalKey<ScaffoldMessengerState> to display dialogs as SnackBar widgets, effectively creating a layered dialog experience. It maintains a stack of active dialogs and provides methods to show, hide, and manage them.

Constructors

DialogService({required GlobalKey<ScaffoldMessengerState> smKey, required BuildContext context})
Creates a DialogService.

Properties

hashCode int
The hash code for this object.
no setterinherited
isActive bool
Checks if there are any active dialogs in the stack.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

hide([UniqueKey? key]) → void
Hides a specific dialog or the most recently shown dialog.
hideAll() → void
Hides all active dialogs in the stack.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
show({String title = 'Error', String? desc, DialogType type = DialogType.error}) Future<UniqueKey>
Displays a custom dialog.
toString() String
A string representation of this object.
inherited

Operators

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