mapChildren method

Stream<Snapshot> mapChildren(
  1. dynamic mapper(
    1. String key,
    2. Snapshot value
    )
)

Updates the content of each child with the value returned by mapper

Implementation

Stream<Snapshot> mapChildren(
        dynamic Function(String key, Snapshot value) mapper) =>
    map((s) {
      var keys = s.asMap()?.keys;
      if (keys == null) return s;
      return keys.fold(s, (s, k) => s.setPath(k, mapper(k, s.child(k))));
    });