extract method

Map<String, dynamic> extract([
  1. String path = ''
])

Returns a map of the subset of documents in the store under the given path. Data for the given path can exist in two different places:

  1. It necessarily exists in all of the value stores resolved under the given path.
  2. It could exist in any of the parent value stores of the given path, such as in the example of the "users" path containing data for path users__1, users__1__friends__1, etc.

Implementation

Map<String, dynamic> extract([String path = '']) {
  Map<String, dynamic> data = {};

  final parentStores = _store.extractParentPath(path).values;
  final childStores = _store.extractValues(path);

  for (final parentStore in parentStores) {
    data.addAll(parentStore.extract(path));
  }
  for (final childStore in childStores) {
    data.addAll(childStore.extract(path));
  }

  return data;
}