getError method

Exception? getError([
  1. dynamic error
])

Return the 'last' error if any.

Implementation

Exception? getError([dynamic error]) {
  var ex = _error;
  if (error == null) {
    _error = null;
  } else {
    if (error is! Exception) {
      _error = Exception(error.toString());
    } else {
      _error = error;
    }
    ex ??= _error;
  }
  return ex;
}