Bytes.fromBytesLike constructor

Bytes.fromBytesLike(
  1. BytesLike data
)

Zero-copy conversion from a BytesLike implementation.

If data is already a Bytes, the same instance is returned.

Implementation

factory Bytes.fromBytesLike(BytesLike data) {
  if (data is Bytes) return data;
  return Bytes.fromUint8List(data.asUint8List());
}