ErrorHandler class abstract
Interface for GetxControllerPlus that simplifies error handling by delegating caught error-like Objects under most try-catch blocks into:
- Exposed View (Widgets, GetViews) codes
- Mutating existing state values under the GetxControllerPlus
Example:
Delegating handlers to a View scope (GetView example)
Widget build(BuildContext context) {
controller.setErrorHandler<FormatException>(
showDialog(
context,
builder: (context,) => AlertDialog(
title: Text("Error",),
message: Text("Failure to format something",),
),
);
);
return MyWidget(
...
);
}
Yet another example:
Mutate Observable states under GetXController itself
@override
void onInit() {
setErrorHandler<IOException>(...);
setErrorHandler<ArgumentError>(...);
}
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
handleError(
Object err) → FutureOr< void> - Typically invoked within catch block inside GetxController codes. Example:
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setErrorHandler<
T> (ErrorHandlerCallback< T> handler) → void - Recommended invoke locations:
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited