makeMemorize function

LiveData<Memorize> makeMemorize(
  1. Map<Symbol, LiveData> liveDataMap, {
  2. String? name,
  3. bool verifyDataChange = false,
})

Implementation

LiveData<Memorize> makeMemorize(
  Map<Symbol, LiveData> liveDataMap, {
  String? name,
  bool verifyDataChange = false,
}) {
  Iterable<Stream<dynamic>> streams = liveDataMap
      .map((name, lv) {
        return MapEntry(name, lv.stream?.map((stream) => _Pair(name, stream)));
      })
      .values
      .map((e) => e!);
  var streamGroup = StreamGroup.merge(streams);
  var m = Memorize(init: liveDataMap);
  var memorizeBarrier = streamGroup.map((pair) => m..put(pair.first, pair.second));
  LiveData<Memorize> liveData = LiveData.stream(
    m,
    memorizeBarrier,
    name: name,
    verifyDataChange: verifyDataChange,
  );
  return liveData;
}