onStateError method
Call the latest SateX object's error routine Possibly the error occurred there.
Implementation
bool onStateError(FlutterErrorDetails details) {
//
final state = lastState;
bool caught = state != null;
if (caught) {
//
try {
//
final stack = details.stack?.toString();
//
if (stack != null) {
// That State object's build() function was called.
var name = state.toString();
name = name.substring(0, name.indexOf('#'));
caught = stack.contains('$name.build');
if (!caught) {
// If it involves particular libraries
final library = details.library;
caught = library != null &&
(library.contains('gesture') || library.contains('widgets'));
}
// Call the StateX's onError() function
if (caught && state != this) {
_errorStateName = name;
state.onError(details);
} else {
_errorStateName = null;
}
}
} catch (e, stack) {
recordException(e, stack);
}
// Always test if there was an error in the error handler
// Include it in the error reporting as well.
if (hasError) {
_onErrorInHandler();
}
}
return caught;
}