DocumentChange.fromJson constructor
- dynamic jsonString,
- dynamic db
Creates a DocumentChange from JSON data.
Parameters:
jsonString: The JSON data to parse.
Returns: A DocumentChange instance.
Example:
var change = DocumentChange.fromJson(jsonData);
Implementation
factory DocumentChange.fromJson(dynamic jsonString, dynamic db) {
dynamic data = jsonString;
return DocumentChange(
doc: DocumentSnapshot.fromJson(data["doc"], db),
newIndex : data["newIndex"],
oldIndex : data["oldIndex"],
type: DocumentChangeTypeExtension.fromString(data["ctype"])
?? DocumentChangeType.added
);
}