child abstract method

Snapshot child(
  1. String path
)

The Snapshot that represents a (grand)child of this Snapshot.

The path should be in a JSON pointer format (RFC 6901). The leading / is optional. Therefore, the following two expressions are equivalent

snapshot.child('firstname')
snapshot.child('/firstname')

The returned children are cached. Subsequent calls to child will return the exact same object. Also, the result of a call with a path with multiple segments will result in the exact same object as recursive calls to child with the different segments:

snapshot.child('address/city') == snapshot.child('address').child('city')

When the content of this snapshot is not a Map or List, an empty snapshot will be returned.

When the content is a Map, the first segment of the path will be used as key and the returned child will have the content of the child in this map that corresponds to this key. When the map does not have a child with this key or that child is equal to null, an empty Snapshot will be returned. Therefore, it is not possible to distinguish between a non-existing child and a null-child.

When the content is a List, the first segment of the path will be converted to an integer and used as index. When this conversion fails or the index is out of range, an empty snapshot will be returned.

Implementation

Snapshot child(String path);