get<T> function

Future<T?> get<T>(
  1. String path
)

Get a node data

Note that, FirebaseDatabase.instance.get has a bug. So once is being used.

path is the path of the node.

Example: below will get the value of /settings/abc/path/to/node. If the node does not exist, it will return null.

final value = await get('/settings/abc/path/to/node');

Implementation

Future<T?> get<T>(String path) async {
  final snapshot = await getSnapshot(path);
  if (!snapshot.exists) {
    return null;
  }
  return snapshot.value as T;
}