data property

dynamic get data

The body parsed as JSON, or the raw body if it is not JSON. Parses on every access: read it once per response.

Implementation

dynamic get data {
  if (body == null || body!.isEmpty) return null;
  try {
    return jsonDecode(body!);
  } catch (_) {
    return body;
  }
}