push method

Generates a new child location using a unique key and returns a DatabaseReference to it. This is useful when the children of a Firebase Database location represent a list of items.

The unique key generated by childByAutoId: is prefixed with a client-generated timestamp so that the resulting list will be chronologically-sorted.

Implementation

DatabaseReference push() {
  final String key = PushIdGenerator.generatePushChildName();
  final List<String> childPath = List<String>.from(_pathComponents)..add(key);
  return DatabaseReference._(_database, childPath);
}