embed static method

Uint8List embed(
  1. Uint8List imageBytes,
  2. Uint8List data
)

Implementation

static Uint8List embed(Uint8List imageBytes, Uint8List data) {
  if (data.length < 8 || !_matchesMagic(data, 0, _magic)) {
    throw ArgumentError('INVALID_PAYLOAD');
  }

  final jpegBytes = toJpegQ80(imageBytes);
  if (jpegBytes == null) {
    throw ArgumentError('INVALID_PNG');
  }

  final result = _native.robust2Embed(jpegBytes, data);
  if (result == null) {
    throw StateError('CAPACITY_EXCEEDED');
  }
  return result;
}