setPriority function

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

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

Implementation

Future<void> setPriority(String path, Object? priority, {String? app}) {
  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(
    app,
    (a, port) => fdbDbSetPriority(a, p.cast(), pb, pr.length, port),
    'setPriority',
  ).whenComplete(() {
    calloc
      ..free(p)
      ..free(pb);
  });
}