Simple documentation added

Useful utility methods added in query_bowl
This commit is contained in:
Kingkor Roy Tirtho
2022-06-20 14:27:54 +06:00
parent d7635abb0e
commit 634bb3f912
3 changed files with 180 additions and 7 deletions
+3 -1
View File
@@ -16,6 +16,8 @@ typedef QueryListener<T> = FutureOr<void> Function(T);
typedef ListenerUnsubscriber = void Function();
typedef QueryUpdateFunction<T> = FutureOr<T> Function(T? oldData);
class Query<T extends Object, Outside> extends ChangeNotifier {
// all params
final String queryKey;
@@ -224,7 +226,7 @@ class Query<T extends Object, Outside> extends ChangeNotifier {
///
/// Every time a new instance of data should be returned because of
/// immutability
setQueryData(FutureOr<T> Function(T? data) updateFn) async {
void setQueryData(QueryUpdateFunction<T> updateFn) async {
final newData = await updateFn(data);
if (data == newData) {
// TODO: Better Error handling & Error structure