parent method

DatabaseReference? parent()

Gets a DatabaseReference for the parent location. If this instance refers to the root of your Firebase Database, it has no parent, and therefore parent() will return null.

Implementation

DatabaseReference parent() {
  if (_pathComponents.isEmpty) {
    return null;
  }
  return DatabaseReference._(
      _database, (List<String>.from(_pathComponents)..removeLast()));
}