fix(fl_query): use sync connection checker instead of async in every operation
This commit is contained in:
@@ -242,7 +242,7 @@
|
|||||||
"languageVersion": "2.17"
|
"languageVersion": "2.17"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"generated": "2023-05-29T02:30:48.970388Z",
|
"generated": "2023-10-07T04:33:29.262541Z",
|
||||||
"generator": "pub",
|
"generator": "pub",
|
||||||
"generatorVersion": "3.0.2"
|
"generatorVersion": "3.1.0"
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
3.10.2
|
3.13.2
|
||||||
@@ -278,7 +278,7 @@ class InfiniteQuery<DataType, ErrorType, PageType>
|
|||||||
bool get hasNextPage => getNextPage != null;
|
bool get hasNextPage => getNextPage != null;
|
||||||
|
|
||||||
Future<void> _operate(PageType page) async {
|
Future<void> _operate(PageType page) async {
|
||||||
if (!await QueryClient.connectivity.isConnected &&
|
if (!QueryClient.connectivity.isConnectedSync &&
|
||||||
retryConfig.cancelWhenOffline) {
|
retryConfig.cancelWhenOffline) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:async/async.dart';
|
import 'package:async/async.dart';
|
||||||
import 'package:fl_query/src/collections/retry_config.dart';
|
import 'package:fl_query/src/collections/retry_config.dart';
|
||||||
|
import 'package:fl_query/src/core/client.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
mixin Retryer<T, E> {
|
mixin Retryer<T, E> {
|
||||||
@@ -36,6 +37,9 @@ mixin Retryer<T, E> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (!await QueryClient.connectivity.isConnected) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class Mutation<DataType, ErrorType, VariablesType>
|
|||||||
Stream<VariablesType> get mutationStream => _mutationController.stream;
|
Stream<VariablesType> get mutationStream => _mutationController.stream;
|
||||||
|
|
||||||
Future<void> _operate(VariablesType variables) async {
|
Future<void> _operate(VariablesType variables) async {
|
||||||
if (!await QueryClient.connectivity.isConnected &&
|
if (!QueryClient.connectivity.isConnectedSync &&
|
||||||
retryConfig.cancelWhenOffline) {
|
retryConfig.cancelWhenOffline) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ class Query<DataType, ErrorType>
|
|||||||
CancelableOperation<void>? _operation;
|
CancelableOperation<void>? _operation;
|
||||||
|
|
||||||
Future<void> _operate() async {
|
Future<void> _operate() async {
|
||||||
if (!await QueryClient.connectivity.isConnected &&
|
if (!QueryClient.connectivity.isConnectedSync &&
|
||||||
retryConfig.cancelWhenOffline) {
|
retryConfig.cancelWhenOffline) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user