From 2fb7c90fcdb1f4cd88426755ac04d3f9c9ded895 Mon Sep 17 00:00:00 2001 From: Avinash-dhiraj Date: Fri, 12 Apr 2024 16:36:46 +0530 Subject: [PATCH 1/3] feat: updated connectivity plus package and its usage --- .../lib/src/widgets/hooks/subscription.dart | 9 +++++---- packages/graphql_flutter/pubspec.yaml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/graphql_flutter/lib/src/widgets/hooks/subscription.dart b/packages/graphql_flutter/lib/src/widgets/hooks/subscription.dart index 9a140b429..62d8ee319 100644 --- a/packages/graphql_flutter/lib/src/widgets/hooks/subscription.dart +++ b/packages/graphql_flutter/lib/src/widgets/hooks/subscription.dart @@ -69,8 +69,9 @@ class _SubscriptionHookState extends HookState< Stream>, _SubscriptionHook> { late Stream> stream; - ConnectivityResult? _currentConnectivityResult; - StreamSubscription? _networkSubscription; + // ConnectivityResult? _currentConnectivityResult; + List _currentConnectivityResult = [ConnectivityResult.none]; + StreamSubscription>? _networkSubscription; void _initSubscription() { final client = hook.client; @@ -107,7 +108,7 @@ class _SubscriptionHookState extends HookState< super.dispose(); } - Future _onNetworkChange(ConnectivityResult result) async { + Future _onNetworkChange(List result) async { //if from offline to online if (_currentConnectivityResult == ConnectivityResult.none && (result == ConnectivityResult.mobile || @@ -125,7 +126,7 @@ class _SubscriptionHookState extends HookState< } // on exception -> no real connection, set current state to none } on SocketException catch (_) { - _currentConnectivityResult = ConnectivityResult.none; + _currentConnectivityResult = [ConnectivityResult.none]; } } else { _initSubscription(); diff --git a/packages/graphql_flutter/pubspec.yaml b/packages/graphql_flutter/pubspec.yaml index aa43d227c..4bcf11cfe 100644 --- a/packages/graphql_flutter/pubspec.yaml +++ b/packages/graphql_flutter/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: meta: ^1.7.0 path_provider: ^2.0.1 path: ^1.8.0 - connectivity_plus: ^3.0.0 + connectivity_plus: ^6.0.2 hive: ^2.0.0 plugin_platform_interface: ^2.0.0 flutter_hooks: ^0.18.2 From aca4e909e8258a1930d19c04921d63513ba99eed Mon Sep 17 00:00:00 2001 From: Avinash-dhiraj Date: Sat, 13 Apr 2024 07:29:06 +0530 Subject: [PATCH 2/3] fix: updated dart sdk to be comapatible with connectivity_plus --- packages/graphql_flutter/pubspec.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/graphql_flutter/pubspec.yaml b/packages/graphql_flutter/pubspec.yaml index 4bcf11cfe..7d3606ef8 100644 --- a/packages/graphql_flutter/pubspec.yaml +++ b/packages/graphql_flutter/pubspec.yaml @@ -15,6 +15,7 @@ dependencies: meta: ^1.7.0 path_provider: ^2.0.1 path: ^1.8.0 + #connectivity_plus: ^5.0.0 connectivity_plus: ^6.0.2 hive: ^2.0.0 plugin_platform_interface: ^2.0.0 @@ -29,8 +30,8 @@ dev_dependencies: test: ^1.17.12 environment: - sdk: '>=2.12.0 <=3.0.0' - flutter: ">=2.11.0" + sdk: '>=3.3.0 <=4.0.0' + flutter: ">=3.19.5" platforms: android: From 878c5af969c63bdaf6b5df3c5cb8b4907c14a162 Mon Sep 17 00:00:00 2001 From: Avinash-dhiraj Date: Sat, 13 Apr 2024 07:30:05 +0530 Subject: [PATCH 3/3] fix: updated dart sdk to be comapatible with connectivity_plus --- packages/graphql_flutter/pubspec.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/graphql_flutter/pubspec.yaml b/packages/graphql_flutter/pubspec.yaml index 7d3606ef8..1db72f18b 100644 --- a/packages/graphql_flutter/pubspec.yaml +++ b/packages/graphql_flutter/pubspec.yaml @@ -15,7 +15,6 @@ dependencies: meta: ^1.7.0 path_provider: ^2.0.1 path: ^1.8.0 - #connectivity_plus: ^5.0.0 connectivity_plus: ^6.0.2 hive: ^2.0.0 plugin_platform_interface: ^2.0.0