RealtimeDbChange.fromJson constructor

RealtimeDbChange.fromJson(
  1. JsonMap json
)

Implementation

factory RealtimeDbChange.fromJson(JsonMap json) {
  final typeStr = json['operationType']?.toString();
  final type = switch (typeStr) {
    'insert' => RealtimeDbChangeType.insert,
    'update' => RealtimeDbChangeType.update,
    'delete' => RealtimeDbChangeType.delete,
    _ => RealtimeDbChangeType.change,
  };

  return RealtimeDbChange(
    type: type,
    collection: json['collection']!.toString(),
    docId: json['docId']!.toString(),
    fullDocument: json['fullDocument'] as JsonMap?,
  );
}