plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

[Bug]: [connectivity_plus][iOS] checkConnectivity returns None when run twice

Open quocviet1996 opened this issue 1 year ago • 4 comments

Platform

Android and IOS

Plugin

connectivity_plus

Version

all version

Flutter SDK

3.7.2

Steps to reproduce

Open onConnectivityChanged.listen at screen A, then remove screen A, navigate to screen B, and run Connectivity().checkConnectivity(), you will see sometime or always it returns none

Code Sample

Screen A: 
subscription =
        connectivity.onConnectivityChanged.listen((ConnectivityResult result) {
      setState(() {
_isOffline = result == ConnectivityResult.none;
      });
    });
Screen B: 
var connectivityResult = await (Connectivity().checkConnectivity());

Logs

Don't have Logs

Flutter Doctor

[✓] Flutter (Channel stable, 3.7.2, on macOS 13.3.1 22E772610a darwin-arm64, locale en-VN)
    • Flutter version 3.7.2 on channel stable at /Users/macbookm1/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 32fb2f948e (11 months ago), 2023-02-08 07:30:10 -0800
    • Engine revision f40b73f8a4
    • Dart version 2.19.2
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/macbookm1/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.77.3)
    • VS Code at /Users/macbookm1/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.78.0

[✓] Connected device (4 available)
    • Ngurn duj🍓 (mobile)       • 1f7ae3dfd42c61af48b2e836c394e761bff908e5 • ios            • iOS 16.7.2 20H115
    • iPhone 14 Pro Max (mobile) • 403DD1E1-3CD5-4348-88C1-D3187DB93A3D     • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)            • macos                                    • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)               • chrome                                   • web-javascript • Google Chrome 120.0.6099.109

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Checklist before submitting a bug

  • [X] I searched issues in this repository and couldn't find such bug/problem
  • [X] I Google'd a solution and I couldn't find it
  • [X] I searched on StackOverflow for a solution and I couldn't find it
  • [X] I read the README.md file of the plugin
  • [X] I'm using the latest version of the plugin
  • [X] All dependencies are up to date with flutter pub upgrade
  • [X] I did a flutter clean
  • [X] I tried running the example project

quocviet1996 avatar Dec 20 '23 10:12 quocviet1996

Same issue here, we do listen to .onConnectivityChanged events on many occasions, and since the migration from connection: 3.0.2 to connection_plus: 5.0.2 iOS app version does briefly report ConnectivityResult.none, to then follow up with actual connection state, e.g. ConnectivityResult.wifi. The incorrect .none report only happens for subsequent stream requests, first one works correctly.

Above issue was observed on iPadOS 15.8.1 and iOS 17.3, Flutter SDK 3.16.7. Issue does not affect Android.

wrbl606 avatar Feb 09 '24 07:02 wrbl606

Same issue here. 5.0.2 iOS 17.2

hunterwilhelm avatar Feb 14 '24 04:02 hunterwilhelm

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar May 15 '24 00:05 github-actions[bot]