parseResponseError method

String parseResponseError(
  1. dynamic response
)

Implementation

static String parseResponseError(dynamic response) {
  if (response == null) {
    return null;
  } else if (response is Map<String, dynamic>) {
    Map<String, dynamic> map = response;
    if (map.containsKey('error')) {
      String errorDescription = map['error'];
      switch (errorDescription) {
        case 'invalid_grant':
          return 'Usuário e/ou senha inválido';
      }
    } else if (map.containsKey('message')) {
      return map['message'];
    } else if (map.containsKey('Message')) {
      return map['Message'];
    }
  }
  return null;
}