disableOverflowError function
void
disableOverflowError()
Implementation
void disableOverflowError() {
// FlutterError.onError != FlutterError.presentError in Widget Test
// See test/error/disable_overflow_error_test.dart
FlutterExceptionHandler? originalOnError = FlutterError.onError;
FlutterError.onError = (details) {
bool isOverflowError = false;
final exception = details.exception;
if (exception is FlutterError) {
isOverflowError = exception.diagnostics.any(
(e) => e.value.toString().contains('A RenderFlex overflowed by'),
);
}
if (isOverflowError) {
debugPrint('A RenderFlex overflowed');
} else if (originalOnError != null) {
originalOnError(details);
}
};
}