removed dependOnQuery from beacuse of infinite renders

example created for various usecases with various features
hooks now use standard hook API instead of using Hook Class
variable query & mutation not working bug fix
mutation onMutate listeners not getting called bug fix
This commit is contained in:
Kingkor Roy Tirtho
2022-06-24 12:51:27 +06:00
parent 2ead7fd2be
commit d8024714cd
27 changed files with 1117 additions and 680 deletions
@@ -0,0 +1,43 @@
import 'package:fl_query/fl_query.dart';
import 'package:flutter/material.dart';
final lazyQueryJob = QueryJob<String, String>(
queryKey: "lazy-query",
enabled: false,
task: (queryKey, data, _) {
return Future.delayed(const Duration(milliseconds: 500),
() => "Result: key=$queryKey value=$data");
},
);
class LazyQueryExample extends StatelessWidget {
const LazyQueryExample({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"# Lazy Query Example",
style: Theme.of(context).textTheme.headline5,
),
QueryBuilder<String, String>(
job: lazyQueryJob,
externalData: "Love",
builder: (context, query) {
return Row(
children: [
Text("Current Data: ${query.data ?? "Loading"}"),
ElevatedButton(
child: const Text("Refetch Query"),
onPressed: () => query.refetch(),
),
],
);
},
),
],
);
}
}