scheduleMicrotask utils removed in favor of dart:async

getQueryData wrong arrangment of arguments
Query & Retryer's future property is replaced with Completer
queryFn, fetchFn & fn types corrected
exported all the functions/class/enum  from core (incomplete)
flutter dependency dropped since the core is a Dart package
This commit is contained in:
Kingkor Roy Tirtho
2022-02-12 12:58:17 +06:00
parent 70b84fe85a
commit 58f98e6e74
12 changed files with 109 additions and 105 deletions
+14 -16
View File
@@ -127,20 +127,18 @@ var todos = [
},
];
void main(List<String> arguments) {
QueryCache cache = QueryCache();
for (var todo in todos.asMap().entries) {
cache.writeQuery(QueryKey.fromList(["KEY", todo.key.toString()]), data: {
"data": todo.value,
"meta": {
"created": DateTime.now(),
"expiration": DateTime.now().add(Duration(hours: 2))
}
});
}
for (var i = 0; i < todos.length; i++) {
var result = cache.readQuery(QueryKey.fromList(["KEY", i.toString()]));
print(result);
}
void main(List<String> arguments) async {
var key = QueryKey("TEST");
QueryClient queryClient = QueryClient();
queryClient.mount();
var data = await queryClient.fetchQuery<Map, dynamic, Map>(
queryKey: key,
queryFn: (context) {
return Future.value(todos.first);
},
);
print("FETCHED DATA=====");
print(data);
print("======CACHED DATA");
print(queryClient.getQueryData(key));
}