BsonBinary.fromBuffer constructor

BsonBinary.fromBuffer(
  1. BsonBinary buffer
)

Implementation

factory BsonBinary.fromBuffer(BsonBinary buffer) {
  var data = extractData(buffer);
  if (data.subType == subtypeUuid) {
    return BsonUuid.from(data.byteList);
  } else if (data.subType != subtypeBinary) {
    throw ArgumentError(
        'Binary subtype "${data.subType}" is not yet managed');
  }
  return BsonBinary.from(data.byteList);
}