Internal API change

now query & mutation share same base class
queries are now self-refetchable
queryJobs & mutationJobs now support dynamic key allowing dynamic Query/Mutation creation
query status & mutation status are now just on point & accurate
This commit is contained in:
Kingkor Roy Tirtho
2022-06-21 17:16:06 +06:00
parent 634bb3f912
commit e0c70d153f
13 changed files with 417 additions and 184 deletions
+30
View File
@@ -11,3 +11,33 @@ Future<void> callQueryListeners<T>(Set<QueryListener<T>> listeners, T data) {
}
const uuid = Uuid();
bool isShallowEqualList(List list1, List list2) {
return list1.asMap().entries.every((l1Entry) {
return l1Entry.value == list2[l1Entry.key];
});
}
bool isShallowEqualSet(Set list1, Set list2) {
return isShallowEqualList(list1.toList(), list2.toList());
}
bool isShallowEqualMap(Map list1, Map list2) {
return list1.entries.every((l1Entry) {
return l1Entry.value == list2[l1Entry.key];
});
}
bool isShallowEqual(Object obj1, Object obj2) {
if (obj1 is List && obj2 is List) {
return isShallowEqualList(obj1, obj2);
} else if (obj1 is Set && obj2 is Set) {
return isShallowEqualSet(obj1, obj2);
} else if (obj1 is Map && obj2 is Map) {
return isShallowEqualMap(obj1, obj2);
} else {
// for other types basically comparing references for non primitive
// types. And primitives are always compared by value
return obj1 == obj2;
}
}