write method Null safety

void write(
  1. Object? obj
)

Write content into the body of the HTTP request.

Implementation

void write(Object? obj) {
  if (hasBody) {
    if (obj != null) {
      _body!.add(encoding.encoder.convert(obj.toString()));
    }
  } else {
    throw StateError('write not allowed for method $method');
  }
}