write method

  1. @override
void write(
  1. Object? obj
)
override

Writes the string representation of object.

Converts object to a string using object.toString().

Notice that calling sink.write(null) will will write the "null" string.

Implementation

@override
void write(Object? obj) {
  var msg = obj.toString();
  _currentLine ??= _createLine();
  _currentLine!._buf.write(msg);
  var end = _currentLine!._end;
  _currentLine!._end = SourceLocation(
    end.offset + msg.length,
    sourceUrl: end.sourceUrl,
    line: end.line,
    column: end.column + msg.length,
  );
  _length += msg.length;
  _currentLine!._lastSpan = SourceSpan(end, _currentLine!._end, msg);
}