getBytes method Null safety

Uint8Buffer getBytes(
  1. String s
)

Encodes all the characters in the specified string into a sequence of bytes.

Implementation

typed.Uint8Buffer getBytes(String s) {
  _validateString(s);
  final stringBytes = typed.Uint8Buffer();
  stringBytes.add(s.length >> 8);
  stringBytes.add(s.length & 0xFF);
  stringBytes.addAll(encoder.convert(s));
  return stringBytes;
}