setPriority method

Future<void> setPriority(
  1. Object? priority
)

Sets the priority of this location: null, a num, a String or a ServerValue. The client keeps no priority for a location that holds no data: there the write is sent but raises no local event. To create data with a priority, use set(value, priority: p). It checks no depth or length. With persistence the write is stored on disk and sent again after a restart; the Future of the run that made it is gone then.

Implementation

Future<void> setPriority(Object? priority) {
  final Path path = spec.path;
  validateWritablePath('setPriority', path);
  validateUserPriority('setPriority', priority);
  final Path priorityPath = path.child(ChildKey.priority);
  final Node node = userValueNode(priority);
  return database.write(
    (Repo repo, WriteCompletion done) =>
        repo.setValue(priorityPath, node, onComplete: done),
  );
}