setPriority function

Future<void> setPriority(
  1. String path,
  2. Object? priority
)

Sets the priority of an existing node, leaving its value alone.

Implementation

Future<void> setPriority(String path, Object? priority) {
  final pr = encodeVariant(priority);
  final p = path.toNativeUtf8();
  final pb = calloc<Uint8>(pr.isEmpty ? 1 : pr.length);
  if (pr.isNotEmpty) pb.asTypedList(pr.length).setAll(0, pr);
  return _awaitDbOutcome(
    (port) => fdbDbSetPriority(p.cast(), pb, pr.length, port),
    'setPriority',
  ).whenComplete(() {
    calloc
      ..free(p)
      ..free(pb);
  });
}