getException method Null safety

HttpException getException(
  1. int statusCode,
  2. String message
)

Implementation

static HttpException getException(int statusCode, String message) {
  switch (statusCode) {
    case 204:
      return InvalidInputException(message);
    case 400:
      return BadRequestException(message);
    case 401:
    case 403:
      return UnauthorisedException(message);
    case 500:
    default:
      return FetchDataException(
          'Error occurred while communicating with the server '
          'with status code: $statusCode');
  }
}