ApiException.fromPlatformException constructor

ApiException.fromPlatformException(
  1. PlatformException e
)

Implementation

factory ApiException.fromPlatformException(final PlatformException e) {
  final Map<String, dynamic> errorDetails = e.detailsMap;
  final statusCode = errorDetails.getOrDefault(_statusCodeKey, 0);
  final errorFlags =
      errorDetails.getOrDefault(_errorFlagsKey, <dynamic, dynamic>{});

  errorDetails.remove(_statusCodeKey);
  errorDetails.remove(_errorFlagsKey);

  return ApiException(
      e.code, e.messageString, errorDetails, errorFlags, statusCode);
}