bodyAsInteger method

int bodyAsInteger()

Converts the response data to an integer.

Returns:

  • The response data as an integer.

Implementation

int bodyAsInteger() {
  if (data is String) {
    return int.parse(data);
  }
  if (data is num) {
    return data.toInt();
  }
  return data;
}