bodyIsEmpty property

bool get bodyIsEmpty

Indicates if there is a body has content or not.

Returns true if the body is non-empty (i.e. has been set to more than one byte or a string with one or more characters).

Returns true if the body has not been set, or has been set to zero bytes or an empty string.

Implementation

bool get bodyIsEmpty {
  switch (_body) {
    case SimulatedResponseBodyType.none:
      return true;
    case SimulatedResponseBodyType.bytes:
      final b = _bodyBytes;
      return b == null || b.isEmpty;
    case SimulatedResponseBodyType.string:
      final s = _bodyStr;
      return s == null || s.isEmpty;
  }
}