UserExceptionDialog class
A widget that listens to UserExceptions from Superpowers and displays them in a dialog.
Use it like this:
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => BlocProvider(
create: (_) => MySuperpowers(),
child: MaterialApp(
home: UserExceptionDialog(
child: MyHomePage(),
),
),
);
}
When an action throws a UserException with UserException.ifOpenDialog
set to true (the default), the exception is added to Superpowers's static
error queue and this widget will display it in a dialog.
You can customize the dialog by providing onShowUserExceptionDialog.
See also:
- UserExceptionToast, which shows exceptions as toast notifications (SnackBars).
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- UserExceptionDialog
Constructors
- UserExceptionDialog({required Widget child, ShowUserExceptionDialog? onShowUserExceptionDialog, bool useLocalContext = false, bool showErrorsOneByOne = true, Key? key})
-
const
Properties
- child → Widget
-
The child widget to display.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
Optional navigator key to use for showing dialogs.
If provided and useLocalContext is false, this key's context will be used.
final
- onShowUserExceptionDialog → ShowUserExceptionDialog?
-
Custom dialog implementation. If not provided, a default platform-aware
dialog will be shown (Material on Android/Web, Cupertino on iOS).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showErrorsOneByOne → bool
-
If true (the default), errors are shown one at a time. The next error
dialog will only appear after the current one is dismissed.
final
- useLocalContext → bool
-
If false (the default), the dialog will use the root navigator context.
If true, it will use the local context of this widget.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< UserExceptionDialog> -
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