add method
Adds data
to this bytes instance.
data
can be an int,List<int>
, Uint8List or a BytesEmitter.
Implementation
void add(Object? data, {String? description}) {
if (data == null) return;
if (data is List<int>) {
write(data, description: description);
} else if (data is BytesEmitter) {
writeBytes(data, description: description);
} else if (data is int) {
writeByte(data, description: description);
} else {
throw StateError("Can't handle data type: ${data.runtimeType}");
}
}