DocumentReferenceFake.stateful constructor

DocumentReferenceFake.stateful(
  1. String id,
  2. Map<String, dynamic> documentSnapshotData,
  3. void onChanged()
)

Implementation

factory DocumentReferenceFake.stateful(
  String id,
  Map<String, dynamic> documentSnapshotData,
  void Function() onChanged,
) =>
    DocumentReferenceFake(
      id,
      get: () async => DocumentSnapshotFake(id, documentSnapshotData),
      update: (data) async {
        for (final entry in data.entries) {
          documentSnapshotData[entry.key as String] = entry.value;
        }
        onChanged();
      },
      set: (data) async {
        for (final entry in data.entries) {
          documentSnapshotData[entry.key] = entry.value;
        }
        onChanged();
      },
    );