createBinary method

KdbxBinary createBinary({
  1. required bool isProtected,
  2. required String name,
  3. required Uint8List bytes,
})

Creates a new binary and adds it to this entry.

Implementation

KdbxBinary createBinary({
  required bool isProtected,
  required String name,
  required Uint8List bytes,
}) {
  // make sure we don't have a path, just the file name.
  final key = _uniqueBinaryName(path.basename(name));
  final binary = KdbxBinary(
    isInline: false,
    isProtected: isProtected,
    value: bytes,
  );
  modify(() {
    file.ctx.addBinary(binary);
    _binaries[key] = binary;
  });
  return binary;
}