handleException static method

void handleException(
  1. FlutterErrorDetails details
)

Implementation

static void handleException(FlutterErrorDetails details) {
  final Map<String, String> errorMsg = <String, String>{
    'exception': details.exceptionAsString(),
    'stackTrace': details.stack.toString(),
  };
  final Object exception = details.exception;
  logger.e(errorMsg);
  if (exception is BaseError) {
    ToastUtil.error(exception.message!);
  } else if (exception is DioError) {
    if (exception.error is ApiError) {
      ToastUtil.error('${exception.error.statusMessage}');
      return;
    }
    ToastUtil.error('$exception');
  } else {
    // ToastUtil.error('$exception');
  }
}