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
44 lines
1.2 KiB
Dart
44 lines
1.2 KiB
Dart
import 'package:fl_query/query.dart';
|
|
import 'package:uuid/uuid.dart';
|
|
|
|
Future<void> callQueryListeners<T>(Set<QueryListener<T>> listeners, T data) {
|
|
return Future.wait(listeners.map(
|
|
(listener) => Future.value(listener(data)),
|
|
));
|
|
// for (final listener in listeners) {
|
|
// await listener(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;
|
|
}
|
|
}
|