fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.56k stars 946 forks source link

[Bug]: connectivity_plus(v6.0.1) connectivity status invalid #2810

Closed Thientran2910 closed 5 months ago

Thientran2910 commented 5 months ago

Platform

IOS 17.2

Plugin

connectivity_plus

Version

6.0.1

Flutter SDK

3.19.5

Steps to reproduce

Env: Flutter 3.19.5, Dart 3.3.3 Device: Macbook M3 Pro I'm using iphone 15(ios 17.2) simulator I'm using subscription for listen connectivty change Connectivity().onConnectivityChanged

Code Sample

StreamSubscription<List<ConnectivityResult>>? _subscription;

void init() {
_subscription = Connectivity()
        .onConnectivityChanged
        .listen(listener);
}

void listener(List<ConnectivityResult> results) async {
    print("results $results");
}

void dispose() {
    _subscription?.cancel();
}

Logs

Launching lib/main_dev.dart on iPhone 15 in debug mode...
Running Xcode build...
Xcode build done.                                           23.1s
[ERROR:flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm(42)] Using the Impeller rendering backend.
Debug service listening on ws://127.0.0.1:56605/RTmkyAEGWLc=/ws
Syncing files to device iPhone 15...
[log] 🟒 INFO(): 2024-04-03 14:27:45.373
>> [DeviceState] βœ… initPlatformState successfully: {name: iPhone 15, systemName: iOS, systemVersion: 17.2, model: iPhone, localizedModel: iPhone, identifierForVendor: DEBC70B9-45E2-4372-8CCB-663851E98198, isPhysicalDevice: false, utsname.sysname:: Darwin, utsname.nodename:: Thiens-MBP.lan, utsname.release:: 23.4.0, utsname.version:: Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:54 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T6030, utsname.machine:: iPhone15,4}

[log] 🟒 INFO(): 2024-04-03 14:27:45.382
>> [DeviceState] βœ… initAppInfo successfully: PackageInfo(appName: Attlas Pro(Dev), buildNumber: 255, packageName: io.attlas.test, version: 3.0.0, buildSignature: , installerStore: com.apple.simulator)

[log] 🟒 INFO(): 2024-04-03 14:27:45.400
>> [ApiManager] tokenData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:27:45.401
>> Set user token success

[log] 🟒 INFO(): 2024-04-03 14:27:45.422
>> βœ… App Start Success

[log] 🟒 INFO(): 2024-04-03 14:27:45.451
>> [App] App Build ⚠️⚠️⚠️

[log] 🟒 INFO(): 2024-04-03 14:27:45.596
>> [SocketManager<Public>]: start init

[log] 🟒 INFO(): 2024-04-03 14:27:45.607
>> [SocketManager<FuturesPublic>]: start init

[log] 🟒 INFO(): 2024-04-03 14:27:45.634
>> [Route] πŸš€πŸš€πŸš€ push unknown => main-tab
>>> routeNames[1]: [main-tab]

[log] 🟒 INFO(): 2024-04-03 14:27:45.658
>> [MainTab] build called ⚠️⚠️⚠️

[log] 🟒 INFO(): 2024-04-03 14:27:45.867
>> [OneSignalUtils] βœ… Initialize successfully: 002951f5-48c5-4f20-b2b2-9b41450e0028

[log] 🟒 INFO(): 2024-04-03 14:27:45.868
>> [OneSignalUtils] updateClientToken id null token null optedIn null

[log] 🟒 INFO(): 2024-04-03 14:27:45.880
>> [ConnectivityManager] streamResults [ConnectivityResult.wifi]

[log] 🟒 INFO(): 2024-04-03 14:27:45.895
>> [ConnectivityManager] result [ConnectivityResult.wifi]

[log] 🟒 INFO(): 2024-04-03 14:27:45.896
>> [ConnectivityManager] init connection [ConnectivityResult.wifi] 🟒

[log] 🟒 INFO(): 2024-04-03 14:27:45.896
>> [ConnectivityManager] _prevConnectivity null _connectivity [ConnectivityResult.wifi]

[log] 🟒 INFO(): 2024-04-03 14:27:45.896
>> [ConnectivityManager] connection isRestored=false isLost=false

[log] 🟒 INFO(): 2024-04-03 14:27:45.896
>> [ConnectivityManager] _prevConnectivity null _connectivity [ConnectivityResult.wifi]

[log] 🟒 INFO(): 2024-04-03 14:27:45.897
>> [ConnectivityManager] _prevConnectivity null _connectivity [ConnectivityResult.wifi]

[log] 🟒 INFO(): 2024-04-03 14:27:45.897
>> [ConnectivityManager] _prevConnectivity null _connectivity [ConnectivityResult.wifi]

[log] 🟒 INFO(): 2024-04-03 14:27:46.239
>> [SocketManager<FuturesPublic>]: authSocket null

[log] 🟒 INFO(): 2024-04-03 14:27:46.240
>> [SocketManager<FuturesPublic>]: subscribe FuturesMiniTicker_all_v2

[log] 🟒 INFO(): 2024-04-03 14:27:46.241
>> [FuturesMiniTickerSocketSubscribeData]: πŸ”ŒπŸŸ’ socket subscribe to subscribe:futures_mini_ticker extends data: all_v2

[log] 🟒 INFO(): 2024-04-03 14:27:46.243
>> [SocketManager<Public>]: subscribe MiniTicker_all_v2

[log] 🟒 INFO(): 2024-04-03 14:27:46.243
>> [MiniTickerSocketSubscribeData]: πŸ”ŒπŸŸ’ socket subscribe to subscribe:mini_ticker with data: all_v2

[log] 🟒 INFO(): 2024-04-03 14:27:46.244
>> [SocketManager<Public>]: authSocket null

[log] 🟒 INFO(): 2024-04-03 14:27:46.245
>> [SocketManager<FuturesPublic>]: subscribe FuturesMiniTicker_all_v2

[log] 🟒 INFO(): 2024-04-03 14:27:46.245
>> [SocketManager<Public>]: subscribe MiniTicker_all_v2

[log] 🟒 INFO(): 2024-04-03 14:27:46.246
>> [ApiManager] πŸš€ getNotificationConfig, status=success

[log] 🟒 INFO(): 2024-04-03 14:27:46.247
>> NotificationProvider: handleStorageNotificationConfig success βœ…

[log] 🟒 INFO(): 2024-04-03 14:27:46.252
>> [ApiManager] πŸš€ getUnReadNotification, status=success

[log] 🟒 INFO(): 2024-04-03 14:27:46.433
>> [DataConfigHive]: saveAllTokenConfigs: success βœ…

[log] 🟒 INFO(): 2024-04-03 14:27:46.676
>> [AllReferencePriceImpl]: allReferencePrice 94

[log] 🟒 INFO(): 2024-04-03 14:27:47.085
>> [ApiManager] πŸš€ getAllExchangeConfig, status=success

[log] 🟒 INFO(): 2024-04-03 14:27:47.582
>> [ApiManager] πŸš€ getAllFuturesConfig, status=success

[log] 🟒 INFO(): 2024-04-03 14:27:48.127
>> [ApiManager] πŸš€ getExchangeMarketWatch, status=success

[log] 🟒 INFO(): 2024-04-03 14:27:55.231
>> [ConnectivityManager] streamResults [ConnectivityResult.none]

[log] 🟒 INFO(): 2024-04-03 14:27:55.232
>> [ConnectivityManager] result [ConnectivityResult.none]

[log] 🟒 INFO(): 2024-04-03 14:27:55.233
>> [ConnectivityManager] _prevConnectivity [ConnectivityResult.wifi] _connectivity [ConnectivityResult.none]

[log] 🟒 INFO(): 2024-04-03 14:27:55.233
>> [ConnectivityManager] connection isRestored=false isLost=true

[log] 🟒 INFO(): 2024-04-03 14:27:55.234
>> [ConnectivityManager] _prevConnectivity [ConnectivityResult.wifi] _connectivity [ConnectivityResult.none]

[log] 🟒 INFO(): 2024-04-03 14:27:55.243
>> [ConnectivityManager] _prevConnectivity [ConnectivityResult.wifi] _connectivity [ConnectivityResult.none]

[log] 🟒 INFO(): 2024-04-03 14:27:55.244
>> [InternetConnectionMixin<_ConnectionStatusState-main>]: πŸ”΄ isLost

[log] 🟒 INFO(): 2024-04-03 14:27:55.252
>> [ConnectivityManager] _prevConnectivity [ConnectivityResult.wifi] _connectivity [ConnectivityResult.none]

[log] 🟒 INFO(): 2024-04-03 14:27:55.252
>> [InternetConnectionMixin<_NetworkMonitorContentState>]: πŸ”΄ isLost

[log] 🟒 INFO(): 2024-04-03 14:28:05.006
>> [ConnectivityManager] streamResults [ConnectivityResult.none]

[log] 🟒 INFO(): 2024-04-03 14:28:05.008
>> [ConnectivityManager] result [ConnectivityResult.none]

[log] 🟒 INFO(): 2024-04-03 14:28:06.011
>> [ConnectivityManager] result [ConnectivityResult.none]

[log] 🟒 INFO(): 2024-04-03 14:28:07.015
>> [ConnectivityManager] result [ConnectivityResult.none]

[log] 🟒 INFO(): 2024-04-03 14:28:08.018
>> [ConnectivityManager] result [ConnectivityResult.none]

Flutter Doctor

[βœ“] Flutter (Channel stable, 3.19.5, on macOS 14.4 23E214 darwin-arm64, locale en-VN)
    β€’ Flutter version 3.19.5 on channel stable at /Users/thientv/Workspace/flutter
    β€’ Upstream repository https://github.com/flutter/flutter.git
    β€’ Framework revision 300451adae (6 days ago), 2024-03-27 21:54:07 -0500
    β€’ Engine revision e76c956498
    β€’ Dart version 3.3.3
    β€’ DevTools version 2.31.1

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    β€’ Android SDK at /Users/thientv/Library/Android/sdk
    β€’ Platform android-34, build-tools 34.0.0
    β€’ ANDROID_HOME = /Users/thientv/Library/Android/sdk
    β€’ Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    β€’ Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[βœ“] Xcode - develop for iOS and macOS (Xcode 15.2)
    β€’ Xcode at /Applications/Xcode.app/Contents/Developer
    β€’ Build 15C500b
    β€’ CocoaPods version 1.15.2

[βœ“] Chrome - develop for the web
    β€’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[βœ“] Android Studio (version 2023.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 17.0.9+0-17.0.9b1087.7-11185874)

[βœ“] VS Code (version 1.87.2)
    β€’ VS Code at /Applications/Visual Studio Code.app/Contents
    β€’ Flutter extension version 3.84.0

[βœ“] Connected device (3 available)
    β€’ iPhone 15 (mobile) β€’ 11D8315B-9926-4460-877F-BB8EB83B5BD5 β€’ ios            β€’ com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator)
    β€’ macOS (desktop)    β€’ macos                                β€’ darwin-arm64   β€’ macOS 14.4 23E214 darwin-arm64
    β€’ Chrome (web)       β€’ chrome                               β€’ web-javascript β€’ Google Chrome 123.0.6312.87
    ! Error: Browsing on the local area network for Thientv. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for Tristan. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[βœ“] Network resources
    β€’ All expected network resources are available.

! Doctor found issues in 1 category.

Checklist before submitting a bug

miquelbeltran commented 5 months ago

I'm using iphone 15(ios 17.2) simulator

:ballot_box_with_check: I read the README.md file of the plugin

No, you didn't. Because it clearly says:

On iOS simulators, the connectivity types stream might not update when Wi-Fi status changes. This is a known issue.