getKeys function

Future<List<String>> getKeys(
  1. String path
)

Get a list of keys of a node

path is the path of the node.

! It returns an empty list if the node does not exist.

Implementation

Future<List<String>> getKeys(String path) async {
  final snapshot = await getSnapshot(path);
  if (!snapshot.exists) {
    return [];
  }
  final value = snapshot.value;
  if (value is Map) {
    return value.keys.cast<String>().toList();
  }
  return [];
}