fix: refetchOnExternalDataChange isn't working #18
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# This is a generated file; do not edit or check into version control.
|
# This is a generated file; do not edit or check into version control.
|
||||||
connectivity_plus=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/
|
connectivity_plus=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/
|
||||||
connectivity_plus_linux=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/
|
connectivity_plus_linux=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/
|
||||||
connectivity_plus_macos=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.6/
|
connectivity_plus_macos=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.6/
|
||||||
connectivity_plus_web=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/
|
connectivity_plus_web=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/
|
||||||
connectivity_plus_windows=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/
|
connectivity_plus_windows=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus_macos","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.6/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus_linux","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus_windows","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus_web","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":["connectivity_plus_linux","connectivity_plus_macos","connectivity_plus_web","connectivity_plus_windows"]},{"name":"connectivity_plus_linux","dependencies":[]},{"name":"connectivity_plus_macos","dependencies":[]},{"name":"connectivity_plus_web","dependencies":[]},{"name":"connectivity_plus_windows","dependencies":[]}],"date_created":"2022-10-12 22:11:02.991775","version":"3.3.4"}
|
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus_macos","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.6/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus_linux","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus_windows","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus_web","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":["connectivity_plus_linux","connectivity_plus_macos","connectivity_plus_web","connectivity_plus_windows"]},{"name":"connectivity_plus_linux","dependencies":[]},{"name":"connectivity_plus_macos","dependencies":[]},{"name":"connectivity_plus_web","dependencies":[]},{"name":"connectivity_plus_windows","dependencies":[]}],"date_created":"2022-12-14 11:46:10.170392","version":"3.3.8"}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# This is a generated file; do not edit or check into version control.
|
# This is a generated file; do not edit or check into version control.
|
||||||
connectivity_plus=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/
|
connectivity_plus=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/
|
||||||
connectivity_plus_linux=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/
|
connectivity_plus_linux=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/
|
||||||
connectivity_plus_macos=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.4/
|
connectivity_plus_macos=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.4/
|
||||||
connectivity_plus_web=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/
|
connectivity_plus_web=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/
|
||||||
connectivity_plus_windows=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/
|
connectivity_plus_windows=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus_macos","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.4/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus_linux","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus_windows","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus_web","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":["connectivity_plus_linux","connectivity_plus_macos","connectivity_plus_web","connectivity_plus_windows"]},{"name":"connectivity_plus_linux","dependencies":[]},{"name":"connectivity_plus_macos","dependencies":[]},{"name":"connectivity_plus_web","dependencies":[]},{"name":"connectivity_plus_windows","dependencies":[]}],"date_created":"2022-10-12 22:11:06.320813","version":"3.3.4"}
|
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus_macos","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.4/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus_linux","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus_windows","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus_web","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":["connectivity_plus_linux","connectivity_plus_macos","connectivity_plus_web","connectivity_plus_windows"]},{"name":"connectivity_plus_linux","dependencies":[]},{"name":"connectivity_plus_macos","dependencies":[]},{"name":"connectivity_plus_web","dependencies":[]},{"name":"connectivity_plus_windows","dependencies":[]}],"date_created":"2022-12-14 12:54:36.553871","version":"3.3.8"}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
sdk.dir=/home/krtirtho/Android/Sdk
|
sdk.dir=/home/krtirtho/Android/Sdk
|
||||||
flutter.sdk=/opt/flutter
|
flutter.sdk=/home/krtirtho/fvm/versions/3.3.5
|
||||||
flutter.buildMode=debug
|
flutter.buildMode=debug
|
||||||
flutter.versionName=1.0.0
|
flutter.versionName=1.0.0
|
||||||
flutter.versionCode=1
|
flutter.versionCode=1
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// This is a generated file; do not edit or check into version control.
|
// This is a generated file; do not edit or check into version control.
|
||||||
FLUTTER_ROOT=/opt/flutter
|
FLUTTER_ROOT=/home/krtirtho/fvm/versions/3.3.5
|
||||||
FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query/example
|
FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query/example
|
||||||
COCOAPODS_PARALLEL_CODE_SIGN=true
|
COCOAPODS_PARALLEL_CODE_SIGN=true
|
||||||
FLUTTER_TARGET=lib/main.dart
|
FLUTTER_TARGET=lib/main.dart
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# This is a generated file; do not edit or check into version control.
|
# This is a generated file; do not edit or check into version control.
|
||||||
export "FLUTTER_ROOT=/opt/flutter"
|
export "FLUTTER_ROOT=/home/krtirtho/fvm/versions/3.3.5"
|
||||||
export "FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query/example"
|
export "FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query/example"
|
||||||
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
|
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
|
||||||
export "FLUTTER_TARGET=lib/main.dart"
|
export "FLUTTER_TARGET=lib/main.dart"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
|
|||||||
final jobWithExternalData = QueryJob<String, double>(
|
final jobWithExternalData = QueryJob<String, double>(
|
||||||
queryKey: "query-external-data",
|
queryKey: "query-external-data",
|
||||||
cacheTime: const Duration(seconds: 10),
|
cacheTime: const Duration(seconds: 10),
|
||||||
refetchOnExternalDataChange: false,
|
refetchOnExternalDataChange: true,
|
||||||
task: (queryKey, data) {
|
task: (queryKey, data) {
|
||||||
return Future.delayed(const Duration(milliseconds: 500),
|
return Future.delayed(const Duration(milliseconds: 500),
|
||||||
() => "Hello from $queryKey with $data");
|
() => "Hello from $queryKey with $data");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Generated code do not commit.
|
# Generated code do not commit.
|
||||||
file(TO_CMAKE_PATH "/opt/flutter" FLUTTER_ROOT)
|
file(TO_CMAKE_PATH "/home/krtirtho/fvm/versions/3.3.5" FLUTTER_ROOT)
|
||||||
file(TO_CMAKE_PATH "/home/krtirtho/dev/fl-query/packages/fl_query/example" PROJECT_DIR)
|
file(TO_CMAKE_PATH "/home/krtirtho/dev/fl-query/packages/fl_query/example" PROJECT_DIR)
|
||||||
|
|
||||||
set(FLUTTER_VERSION "1.0.0+1" PARENT_SCOPE)
|
set(FLUTTER_VERSION "1.0.0+1" PARENT_SCOPE)
|
||||||
@@ -10,7 +10,7 @@ set(FLUTTER_VERSION_BUILD 1 PARENT_SCOPE)
|
|||||||
|
|
||||||
# Environment variables to pass to tool_backend.sh
|
# Environment variables to pass to tool_backend.sh
|
||||||
list(APPEND FLUTTER_TOOL_ENVIRONMENT
|
list(APPEND FLUTTER_TOOL_ENVIRONMENT
|
||||||
"FLUTTER_ROOT=/opt/flutter"
|
"FLUTTER_ROOT=/home/krtirtho/fvm/versions/3.3.5"
|
||||||
"PROJECT_DIR=/home/krtirtho/dev/fl-query/packages/fl_query/example"
|
"PROJECT_DIR=/home/krtirtho/dev/fl-query/packages/fl_query/example"
|
||||||
"DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
|
"DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
|
||||||
"DART_OBFUSCATION=false"
|
"DART_OBFUSCATION=false"
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
// This is a generated file; do not edit or check into version control.
|
// This is a generated file; do not edit or check into version control.
|
||||||
FLUTTER_ROOT=/opt/flutter
|
FLUTTER_ROOT=/home/krtirtho/fvm/versions/3.3.5
|
||||||
FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query/example
|
FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query/example
|
||||||
COCOAPODS_PARALLEL_CODE_SIGN=true
|
COCOAPODS_PARALLEL_CODE_SIGN=true
|
||||||
FLUTTER_BUILD_DIR=build
|
FLUTTER_BUILD_DIR=build
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# This is a generated file; do not edit or check into version control.
|
# This is a generated file; do not edit or check into version control.
|
||||||
export "FLUTTER_ROOT=/opt/flutter"
|
export "FLUTTER_ROOT=/home/krtirtho/fvm/versions/3.3.5"
|
||||||
export "FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query/example"
|
export "FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query/example"
|
||||||
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
|
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
|
||||||
export "FLUTTER_BUILD_DIR=build"
|
export "FLUTTER_BUILD_DIR=build"
|
||||||
|
|||||||
@@ -58,18 +58,22 @@ class _InfiniteQueryBuilderState<T extends Object, Outside,
|
|||||||
|
|
||||||
void init([T? previousData]) async {
|
void init([T? previousData]) async {
|
||||||
final bowl = QueryBowl.of(context);
|
final bowl = QueryBowl.of(context);
|
||||||
|
final prevInfiniteQuery =
|
||||||
|
bowl.getInfiniteQuery<T, Outside, PageParam>(widget.job.queryKey);
|
||||||
infiniteQuery = bowl.addInfiniteQuery<T, Outside, PageParam>(
|
infiniteQuery = bowl.addInfiniteQuery<T, Outside, PageParam>(
|
||||||
widget.job,
|
widget.job,
|
||||||
externalData: widget.externalData,
|
externalData: widget.externalData,
|
||||||
key: uKey,
|
key: uKey,
|
||||||
);
|
);
|
||||||
final hasExternalDataChanged = infiniteQuery!.externalData != null &&
|
final hasExternalDataChanged = prevInfiniteQuery != null
|
||||||
infiniteQuery!.prevUsedExternalData != null &&
|
? !isShallowEqual(
|
||||||
!isShallowEqual(
|
prevInfiniteQuery.externalData,
|
||||||
infiniteQuery!.externalData!,
|
prevInfiniteQuery.prevUsedExternalData,
|
||||||
infiniteQuery!.prevUsedExternalData!,
|
)
|
||||||
);
|
: !isShallowEqual(
|
||||||
|
infiniteQuery!.externalData,
|
||||||
|
infiniteQuery!.prevUsedExternalData,
|
||||||
|
);
|
||||||
|
|
||||||
if (infiniteQuery!.fetched && hasExternalDataChanged) {
|
if (infiniteQuery!.fetched && hasExternalDataChanged) {
|
||||||
await infiniteQuery!.refetchPages();
|
await infiniteQuery!.refetchPages();
|
||||||
@@ -100,9 +104,7 @@ class _InfiniteQueryBuilderState<T extends Object, Outside,
|
|||||||
// } else {
|
// } else {
|
||||||
// init();
|
// init();
|
||||||
// }
|
// }
|
||||||
} else if (oldWidget.externalData != null &&
|
} else if (!isShallowEqual(oldWidget.externalData, widget.externalData)) {
|
||||||
widget.externalData != null &&
|
|
||||||
!isShallowEqual(oldWidget.externalData!, widget.externalData!)) {
|
|
||||||
if (widget.job.refetchOnExternalDataChange ??
|
if (widget.job.refetchOnExternalDataChange ??
|
||||||
queryBowl.refetchOnExternalDataChange) {
|
queryBowl.refetchOnExternalDataChange) {
|
||||||
QueryBowl.of(context).addInfiniteQuery(
|
QueryBowl.of(context).addInfiniteQuery(
|
||||||
|
|||||||
@@ -383,12 +383,10 @@ class QueryBowl {
|
|||||||
if (prevQuery != null) {
|
if (prevQuery != null) {
|
||||||
// run the query if its still not called or if externalData has
|
// run the query if its still not called or if externalData has
|
||||||
// changed
|
// changed
|
||||||
if (prevQuery.prevUsedExternalData != null &&
|
if (!isShallowEqual(
|
||||||
externalData != null &&
|
prevQuery.prevUsedExternalData,
|
||||||
!isShallowEqual(
|
externalData,
|
||||||
prevQuery.prevUsedExternalData!,
|
)) {
|
||||||
externalData,
|
|
||||||
)) {
|
|
||||||
prevQuery.setExternalData(externalData);
|
prevQuery.setExternalData(externalData);
|
||||||
}
|
}
|
||||||
prevQuery.mount(key);
|
prevQuery.mount(key);
|
||||||
@@ -425,12 +423,10 @@ class QueryBowl {
|
|||||||
if (prevInfiniteQuery != null) {
|
if (prevInfiniteQuery != null) {
|
||||||
// run the query if its still not called or if externalData has
|
// run the query if its still not called or if externalData has
|
||||||
// changed
|
// changed
|
||||||
if (prevInfiniteQuery.prevUsedExternalData != null &&
|
if (!isShallowEqual(
|
||||||
externalData != null &&
|
prevInfiniteQuery.prevUsedExternalData,
|
||||||
!isShallowEqual(
|
externalData,
|
||||||
prevInfiniteQuery.prevUsedExternalData!,
|
)) {
|
||||||
externalData,
|
|
||||||
)) {
|
|
||||||
prevInfiniteQuery.setExternalData(externalData);
|
prevInfiniteQuery.setExternalData(externalData);
|
||||||
}
|
}
|
||||||
prevInfiniteQuery.mount(key);
|
prevInfiniteQuery.mount(key);
|
||||||
@@ -499,12 +495,10 @@ class QueryBowl {
|
|||||||
if (prevQuery != null) {
|
if (prevQuery != null) {
|
||||||
// run the query if its still not called or if externalData has
|
// run the query if its still not called or if externalData has
|
||||||
// changed
|
// changed
|
||||||
final hasExternalDataChanged = prevQuery.prevUsedExternalData != null &&
|
final hasExternalDataChanged = !isShallowEqual(
|
||||||
externalData != null &&
|
prevQuery.prevUsedExternalData,
|
||||||
!isShallowEqual(
|
externalData,
|
||||||
prevQuery.prevUsedExternalData!,
|
);
|
||||||
externalData,
|
|
||||||
);
|
|
||||||
prevQuery.mount(key);
|
prevQuery.mount(key);
|
||||||
if (onData != null) prevQuery.addDataListener(onData);
|
if (onData != null) prevQuery.addDataListener(onData);
|
||||||
if (onError != null) prevQuery.addErrorListener(onError);
|
if (onError != null) prevQuery.addErrorListener(onError);
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ class _QueryBuilderState<T extends Object, Outside>
|
|||||||
|
|
||||||
void init([T? previousData]) async {
|
void init([T? previousData]) async {
|
||||||
final bowl = QueryBowl.of(context);
|
final bowl = QueryBowl.of(context);
|
||||||
|
final prevQuery = bowl.getQuery<T, Outside>(widget.job.queryKey);
|
||||||
query = bowl.addQuery<T, Outside>(
|
query = bowl.addQuery<T, Outside>(
|
||||||
widget.job,
|
widget.job,
|
||||||
externalData: widget.externalData,
|
externalData: widget.externalData,
|
||||||
@@ -66,13 +67,15 @@ class _QueryBuilderState<T extends Object, Outside>
|
|||||||
onData: widget.onData,
|
onData: widget.onData,
|
||||||
onError: widget.onError,
|
onError: widget.onError,
|
||||||
);
|
);
|
||||||
|
final hasExternalDataChanged = prevQuery != null
|
||||||
final hasExternalDataChanged = query!.externalData != null &&
|
? !isShallowEqual(
|
||||||
query!.prevUsedExternalData != null &&
|
prevQuery.externalData,
|
||||||
!isShallowEqual(
|
prevQuery.prevUsedExternalData,
|
||||||
query!.externalData!,
|
)
|
||||||
query!.prevUsedExternalData!,
|
: !isShallowEqual(
|
||||||
);
|
query!.externalData,
|
||||||
|
query!.prevUsedExternalData,
|
||||||
|
);
|
||||||
|
|
||||||
if (query!.fetched && hasExternalDataChanged) {
|
if (query!.fetched && hasExternalDataChanged) {
|
||||||
await query!.refetch();
|
await query!.refetch();
|
||||||
@@ -103,9 +106,7 @@ class _QueryBuilderState<T extends Object, Outside>
|
|||||||
} else {
|
} else {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
} else if (oldWidget.externalData != null &&
|
} else if (!isShallowEqual(oldWidget.externalData, widget.externalData)) {
|
||||||
widget.externalData != null &&
|
|
||||||
!isShallowEqual(oldWidget.externalData!, widget.externalData!)) {
|
|
||||||
if (widget.job.refetchOnExternalDataChange ??
|
if (widget.job.refetchOnExternalDataChange ??
|
||||||
bowl.refetchOnExternalDataChange) {
|
bowl.refetchOnExternalDataChange) {
|
||||||
bowl.fetchQuery(
|
bowl.fetchQuery(
|
||||||
|
|||||||
@@ -31,7 +31,10 @@ bool isShallowEqualMap(Map list1, Map list2) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isShallowEqual(Object obj1, Object obj2) {
|
bool isShallowEqual(dynamic obj1, dynamic obj2) {
|
||||||
|
if (obj1 == null && obj2 == null) return true;
|
||||||
|
if ((obj1 == null && obj2 != null) || (obj2 == null && obj1 != null))
|
||||||
|
return false;
|
||||||
if (obj1 is List && obj2 is List) {
|
if (obj1 is List && obj2 is List) {
|
||||||
return isShallowEqualList(obj1, obj2);
|
return isShallowEqualList(obj1, obj2);
|
||||||
} else if (obj1 is Set && obj2 is Set) {
|
} else if (obj1 is Set && obj2 is Set) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# This is a generated file; do not edit or check into version control.
|
# This is a generated file; do not edit or check into version control.
|
||||||
connectivity_plus=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/
|
connectivity_plus=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/
|
||||||
connectivity_plus_linux=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/
|
connectivity_plus_linux=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/
|
||||||
connectivity_plus_macos=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.6/
|
connectivity_plus_macos=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.6/
|
||||||
connectivity_plus_web=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/
|
connectivity_plus_web=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/
|
||||||
connectivity_plus_windows=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/
|
connectivity_plus_windows=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus_macos","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.6/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus_linux","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus_windows","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus_web","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":["connectivity_plus_linux","connectivity_plus_macos","connectivity_plus_web","connectivity_plus_windows"]},{"name":"connectivity_plus_linux","dependencies":[]},{"name":"connectivity_plus_macos","dependencies":[]},{"name":"connectivity_plus_web","dependencies":[]},{"name":"connectivity_plus_windows","dependencies":[]}],"date_created":"2022-10-12 22:11:05.557834","version":"3.3.4"}
|
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus_macos","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.6/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus_linux","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus_windows","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus_web","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":["connectivity_plus_linux","connectivity_plus_macos","connectivity_plus_web","connectivity_plus_windows"]},{"name":"connectivity_plus_linux","dependencies":[]},{"name":"connectivity_plus_macos","dependencies":[]},{"name":"connectivity_plus_web","dependencies":[]},{"name":"connectivity_plus_windows","dependencies":[]}],"date_created":"2022-12-14 11:46:01.321906","version":"3.3.8"}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# This is a generated file; do not edit or check into version control.
|
# This is a generated file; do not edit or check into version control.
|
||||||
connectivity_plus=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/
|
connectivity_plus=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/
|
||||||
connectivity_plus_linux=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/
|
connectivity_plus_linux=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/
|
||||||
connectivity_plus_macos=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.4/
|
connectivity_plus_macos=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.4/
|
||||||
connectivity_plus_web=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/
|
connectivity_plus_web=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/
|
||||||
connectivity_plus_windows=/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/
|
connectivity_plus_windows=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus_macos","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.4/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus_linux","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus_windows","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus_web","path":"/opt/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":["connectivity_plus_linux","connectivity_plus_macos","connectivity_plus_web","connectivity_plus_windows"]},{"name":"connectivity_plus_linux","dependencies":[]},{"name":"connectivity_plus_macos","dependencies":[]},{"name":"connectivity_plus_web","dependencies":[]},{"name":"connectivity_plus_windows","dependencies":[]}],"date_created":"2022-10-12 22:11:08.760671","version":"3.3.4"}
|
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.9/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus_macos","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.4/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus_linux","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus_windows","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus_web","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.5/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":["connectivity_plus_linux","connectivity_plus_macos","connectivity_plus_web","connectivity_plus_windows"]},{"name":"connectivity_plus_linux","dependencies":[]},{"name":"connectivity_plus_macos","dependencies":[]},{"name":"connectivity_plus_web","dependencies":[]},{"name":"connectivity_plus_windows","dependencies":[]}],"date_created":"2022-12-14 11:46:05.508816","version":"3.3.8"}
|
||||||
@@ -42,6 +42,9 @@ InfiniteQuery<T, Outside, PageParam>
|
|||||||
final oldOnError = usePrevious(onError);
|
final oldOnError = usePrevious(onError);
|
||||||
|
|
||||||
final init = useCallback(([T? previousData]) {
|
final init = useCallback(([T? previousData]) {
|
||||||
|
final hasExternalDataChanged = !isShallowEqual(
|
||||||
|
infiniteQuery.value.externalData,
|
||||||
|
infiniteQuery.value.prevUsedExternalData);
|
||||||
infiniteQuery.value = queryBowl.addInfiniteQuery<T, Outside, PageParam>(
|
infiniteQuery.value = queryBowl.addInfiniteQuery<T, Outside, PageParam>(
|
||||||
job,
|
job,
|
||||||
externalData: externalData,
|
externalData: externalData,
|
||||||
@@ -50,10 +53,6 @@ InfiniteQuery<T, Outside, PageParam>
|
|||||||
onError: onError,
|
onError: onError,
|
||||||
);
|
);
|
||||||
update();
|
update();
|
||||||
final hasExternalDataChanged = infiniteQuery.value.externalData != null &&
|
|
||||||
infiniteQuery.value.prevUsedExternalData != null &&
|
|
||||||
!isShallowEqual(infiniteQuery.value.externalData!,
|
|
||||||
infiniteQuery.value.prevUsedExternalData!);
|
|
||||||
if (infiniteQuery.value.fetched && hasExternalDataChanged) {
|
if (infiniteQuery.value.fetched && hasExternalDataChanged) {
|
||||||
infiniteQuery.value.refetchPages();
|
infiniteQuery.value.refetchPages();
|
||||||
} else if (!infiniteQuery.value.fetched) {
|
} else if (!infiniteQuery.value.fetched) {
|
||||||
@@ -95,42 +94,42 @@ InfiniteQuery<T, Outside, PageParam>
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
final hasOnErrorChanged = oldOnError != onError && oldOnError != null;
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
final hasOnDataChanged = oldOnData != onData && oldOnData != null;
|
final hasOnErrorChanged = oldOnError != onError && oldOnError != null;
|
||||||
if (oldJob != null && oldJob.queryKey != job.queryKey) {
|
final hasOnDataChanged = oldOnData != onData && oldOnData != null;
|
||||||
disposeQuery();
|
if (oldJob != null && oldJob.queryKey != job.queryKey) {
|
||||||
init();
|
disposeQuery();
|
||||||
} else if (oldExternalData != null &&
|
init();
|
||||||
externalData != null &&
|
} else if (!isShallowEqual(oldExternalData, externalData)) {
|
||||||
!isShallowEqual(oldExternalData, externalData)) {
|
if (job.refetchOnExternalDataChange ??
|
||||||
if (job.refetchOnExternalDataChange ??
|
queryBowl.refetchOnExternalDataChange) {
|
||||||
queryBowl.refetchOnExternalDataChange) {
|
QueryBowl.of(context).addInfiniteQuery(
|
||||||
QueryBowl.of(context).addInfiniteQuery(
|
job,
|
||||||
job,
|
externalData: externalData,
|
||||||
externalData: externalData,
|
key: uKey,
|
||||||
key: uKey,
|
onData: onData,
|
||||||
onData: onData,
|
onError: onError,
|
||||||
onError: onError,
|
)..refetchPages();
|
||||||
)..refetchPages();
|
} else {
|
||||||
} else {
|
QueryBowl.of(context)
|
||||||
QueryBowl.of(context)
|
.getQuery(job.queryKey)
|
||||||
.getQuery(job.queryKey)
|
?.setExternalData(externalData);
|
||||||
?.setExternalData(externalData);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (hasOnDataChanged) infiniteQuery.value.removeDataListener(oldOnData);
|
if (hasOnDataChanged) infiniteQuery.value.removeDataListener(oldOnData);
|
||||||
if (hasOnErrorChanged)
|
if (hasOnErrorChanged)
|
||||||
infiniteQuery.value.removeErrorListener(oldOnError);
|
infiniteQuery.value.removeErrorListener(oldOnError);
|
||||||
} else {
|
} else {
|
||||||
if (hasOnDataChanged) {
|
if (hasOnDataChanged) {
|
||||||
infiniteQuery.value.removeDataListener(oldOnData);
|
infiniteQuery.value.removeDataListener(oldOnData);
|
||||||
if (onData != null) infiniteQuery.value.addDataListener(onData);
|
if (onData != null) infiniteQuery.value.addDataListener(onData);
|
||||||
|
}
|
||||||
|
if (hasOnErrorChanged) {
|
||||||
|
infiniteQuery.value.removeErrorListener(oldOnError);
|
||||||
|
if (onError != null) infiniteQuery.value.addErrorListener(onError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (hasOnErrorChanged) {
|
});
|
||||||
infiniteQuery.value.removeErrorListener(oldOnError);
|
|
||||||
if (onError != null) infiniteQuery.value.addErrorListener(onError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -75,23 +75,25 @@ Mutation<T, V> useMutation<T extends Object, V>({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
if (oldJob != null && oldJob.mutationKey != job.mutationKey) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
disposeMutation();
|
if (oldJob != null && oldJob.mutationKey != job.mutationKey) {
|
||||||
init();
|
disposeMutation();
|
||||||
} else {
|
init();
|
||||||
if (oldOnData != onData && oldOnData != null) {
|
} else {
|
||||||
mutation.value.removeDataListener(oldOnData);
|
if (oldOnData != onData && oldOnData != null) {
|
||||||
if (onData != null) mutation.value.addDataListener(onData);
|
mutation.value.removeDataListener(oldOnData);
|
||||||
|
if (onData != null) mutation.value.addDataListener(onData);
|
||||||
|
}
|
||||||
|
if (oldOnError != onError && oldOnError != null) {
|
||||||
|
mutation.value.removeErrorListener(oldOnError);
|
||||||
|
if (onError != null) mutation.value.addErrorListener(onError);
|
||||||
|
}
|
||||||
|
if (oldOnMutate != onMutate && oldOnMutate != null) {
|
||||||
|
mutation.value.removeMutateListener(oldOnMutate);
|
||||||
|
if (onMutate != null) mutation.value.addMutateListener(onMutate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (oldOnError != onError && oldOnError != null) {
|
});
|
||||||
mutation.value.removeErrorListener(oldOnError);
|
|
||||||
if (onError != null) mutation.value.addErrorListener(onError);
|
|
||||||
}
|
|
||||||
if (oldOnMutate != onMutate && oldOnMutate != null) {
|
|
||||||
mutation.value.removeMutateListener(oldOnMutate);
|
|
||||||
if (onMutate != null) mutation.value.addMutateListener(onMutate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ Query<T, Outside> useQuery<T extends Object, Outside>({
|
|||||||
final oldOnError = usePrevious(onError);
|
final oldOnError = usePrevious(onError);
|
||||||
|
|
||||||
final init = useCallback(([T? previousData]) {
|
final init = useCallback(([T? previousData]) {
|
||||||
|
final hasExternalDataChanged = !isShallowEqual(
|
||||||
|
query.value.externalData,
|
||||||
|
query.value.prevUsedExternalData,
|
||||||
|
);
|
||||||
query.value = queryBowl.addQuery<T, Outside>(
|
query.value = queryBowl.addQuery<T, Outside>(
|
||||||
job,
|
job,
|
||||||
externalData: externalData,
|
externalData: externalData,
|
||||||
@@ -50,10 +54,6 @@ Query<T, Outside> useQuery<T extends Object, Outside>({
|
|||||||
onError: onError,
|
onError: onError,
|
||||||
);
|
);
|
||||||
update();
|
update();
|
||||||
final hasExternalDataChanged = query.value.externalData != null &&
|
|
||||||
query.value.prevUsedExternalData != null &&
|
|
||||||
!isShallowEqual(
|
|
||||||
query.value.externalData!, query.value.prevUsedExternalData!);
|
|
||||||
if (query.value.fetched && hasExternalDataChanged) {
|
if (query.value.fetched && hasExternalDataChanged) {
|
||||||
query.value.refetch();
|
query.value.refetch();
|
||||||
} else if (!query.value.fetched) {
|
} else if (!query.value.fetched) {
|
||||||
@@ -82,51 +82,51 @@ Query<T, Outside> useQuery<T extends Object, Outside>({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
final hasOnErrorChanged = oldOnError != onError && oldOnError != null;
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
final hasOnDataChanged = oldOnData != onData && oldOnData != null;
|
final hasOnErrorChanged = oldOnError != onError && oldOnError != null;
|
||||||
if (oldJob != null && oldJob.queryKey != job.queryKey) {
|
final hasOnDataChanged = oldOnData != onData && oldOnData != null;
|
||||||
disposeQuery();
|
if (oldJob != null && oldJob.queryKey != job.queryKey) {
|
||||||
|
disposeQuery();
|
||||||
|
|
||||||
/// setting the new query's initial data as prev query's data
|
/// setting the new query's initial data as prev query's data
|
||||||
/// when [job.keepPreviousData] is true and both are dynamic
|
/// when [job.keepPreviousData] is true and both are dynamic
|
||||||
if (oldJob.isDynamic &&
|
if (oldJob.isDynamic &&
|
||||||
job.isDynamic &&
|
job.isDynamic &&
|
||||||
oldJob.keepPreviousData == true &&
|
oldJob.keepPreviousData == true &&
|
||||||
job.keepPreviousData == true) {
|
job.keepPreviousData == true) {
|
||||||
init(query.value.data);
|
init(query.value.data);
|
||||||
} else {
|
} else {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
} else if (oldExternalData != null &&
|
} else if (!isShallowEqual(oldExternalData, externalData)) {
|
||||||
externalData != null &&
|
if (job.refetchOnExternalDataChange ??
|
||||||
!isShallowEqual(oldExternalData, externalData)) {
|
queryBowl.refetchOnExternalDataChange) {
|
||||||
if (job.refetchOnExternalDataChange ??
|
QueryBowl.of(context).fetchQuery(
|
||||||
queryBowl.refetchOnExternalDataChange) {
|
job,
|
||||||
QueryBowl.of(context).fetchQuery(
|
externalData: externalData,
|
||||||
job,
|
onData: onData,
|
||||||
externalData: externalData,
|
onError: onError,
|
||||||
onData: onData,
|
key: uKey,
|
||||||
onError: onError,
|
);
|
||||||
key: uKey,
|
} else {
|
||||||
);
|
QueryBowl.of(context)
|
||||||
} else {
|
.getQuery(job.queryKey)
|
||||||
QueryBowl.of(context)
|
?.setExternalData(externalData);
|
||||||
.getQuery(job.queryKey)
|
}
|
||||||
?.setExternalData(externalData);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasOnDataChanged) query.value.removeDataListener(oldOnData);
|
if (hasOnDataChanged) query.value.removeDataListener(oldOnData);
|
||||||
if (hasOnErrorChanged) query.value.removeErrorListener(oldOnError);
|
if (hasOnErrorChanged) query.value.removeErrorListener(oldOnError);
|
||||||
} else {
|
} else {
|
||||||
if (hasOnDataChanged) {
|
if (hasOnDataChanged) {
|
||||||
query.value.removeDataListener(oldOnData);
|
query.value.removeDataListener(oldOnData);
|
||||||
if (onData != null) query.value.addDataListener(onData);
|
if (onData != null) query.value.addDataListener(onData);
|
||||||
|
}
|
||||||
|
if (hasOnErrorChanged) {
|
||||||
|
query.value.removeErrorListener(oldOnError);
|
||||||
|
if (onError != null) query.value.addErrorListener(onError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (hasOnErrorChanged) {
|
});
|
||||||
query.value.removeErrorListener(oldOnError);
|
|
||||||
if (onError != null) query.value.addErrorListener(onError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import 'package:fl_query/fl_query.dart';
|
||||||
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
|
|
||||||
|
/// Simple hook based shorthand for [QueryBowl.of(context)]
|
||||||
|
QueryBowl useQueryBowl() {
|
||||||
|
final context = useContext();
|
||||||
|
|
||||||
|
return QueryBowl.of(context);
|
||||||
|
}
|
||||||
@@ -16,7 +16,8 @@ dependencies:
|
|||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_hooks: ^0.18.5+1
|
flutter_hooks: ^0.18.5+1
|
||||||
uuid: ^3.0.6
|
uuid: ^3.0.6
|
||||||
fl_query: ^0.3.1
|
fl_query:
|
||||||
|
path: ../fl_query
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user