ref method

DatabaseReference ref([
  1. String path = ''
])

The reference at path. '', 'a/b' and '/a/b' are accepted and empty segments are dropped ('a//b' is a/b). The .info paths work too, for example ref('.info/connected').onValue, but writes under .info throw an ArgumentError. An invalid key throws an ArgumentError. Makes no request, and still works after close.

Implementation

DatabaseReference ref([String path = '']) {
  if (path.replaceAll('/', '').isNotEmpty) {
    validateRootPathString('ref', 'path', path);
  }
  return DatabaseReference.internal(this, QuerySpec.defaultAt(Path(path)));
}