optimisticReader method Null safety

  1. @visibleForTesting
Map<String, dynamic>? optimisticReader(
  1. String dataId
)
@visibleForTesting

Reads data for the given dataId from the Store, merging in any data from optimistic patches

Implementation

@visibleForTesting
Map<String, dynamic>? optimisticReader(String dataId) =>
    optimisticPatchesStream.value!.values.fold<Map<String, dynamic>>(
      {dataId: store.get(dataId)},
      (merged, patch) => patch.containsKey(dataId)
          ? Map.from(
              utils.deepMerge(
                merged,
                {dataId: patch[dataId]},
              ),
            )
          : merged,
    )[dataId];