Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: connectivity_plus returns no internet on flutter web #3440

Open
8 tasks done
mishraaditya595 opened this issue Jan 21, 2025 · 2 comments
Open
8 tasks done

[Bug]: connectivity_plus returns no internet on flutter web #3440

mishraaditya595 opened this issue Jan 21, 2025 · 2 comments
Labels
bug Something isn't working triage

Comments

@mishraaditya595
Copy link

Platform

Flutter web

Plugin

connectivity_plus

Version

6.1.2

Flutter SDK

3.27.2

Steps to reproduce

Launched a web server in debug mode,
Tried accessing the internet connection status, it returns, ConnectivityResult.none

Code Sample

/// returns true if network is available
Future<bool> getNetworkStatus() async {
 final Connectivity _connectivity = Connectivity();
 List<ConnectivityResult> connectivityResult = await _connectivity.checkConnectivity();
 return connectivityResult.isNotEmpty && !connectivityResult.contains(ConnectivityResult.none);
}

Logs

No logs necessary

Flutter Doctor

[✓] Flutter (Channel stable, 3.27.2, on macOS 15.1 24B83 darwin-arm64, locale en-IN)
    • Flutter version 3.27.2 on channel stable at /Users/applicateai/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 68415ad1d9 (8 days ago), 2025-01-13 10:22:03 -0800
    • Engine revision e672b006cb
    • Dart version 3.6.1
    • DevTools version 2.40.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/applicateai/Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • ANDROID_HOME = /Users/applicateai/Library/Android/sdk
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk-18.0.1.1.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 18.0.1.1+2-6)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16B40
    • CocoaPods version 1.15.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/to/macos-android-setup for detailed instructions).

[✓] IntelliJ IDEA Community Edition (version 2024.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 81.1.3
    • Dart plugin version 242.21829.3

[✓] VS Code (version 1.89.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.102.0

[✓] Connected device (2 available)
    • M2006C3LI (mobile)              • 49GA45OVVONNNJ5H      • android-arm • Android 10 (API 29)
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin      • macOS 15.1 24B83 darwin-arm64

[✓] Network resources
    • All expected network resources are available.

Checklist before submitting a bug

  • I searched issues in this repository and couldn't find such bug/problem
  • I Google'd a solution and I couldn't find it
  • I searched on StackOverflow for a solution and I couldn't find it
  • I read the README.md file of the plugin
  • I'm using the latest version of the plugin
  • All dependencies are up to date with flutter pub upgrade
  • I did a flutter clean
  • I tried running the example project
@mishraaditya595 mishraaditya595 added bug Something isn't working triage labels Jan 21, 2025
@miquelbeltran
Copy link
Member

Please provide more information in your reports, what device and browser you run the app. You can also debug a bit the plugin and see what the web implementation of the plugin is doing, that would help as well.

@princesaini-dev
Copy link

Hi @mishraaditya595
I have implemented connectivity_plus in my Flutter Web project, and it correctly detects internet connectivity status as true or false. I have tested this functionality on Google Chrome and it's working as expected.

My setup details:
connectivity_plus: ^6.1.2
Flutter: 3.27.1
Dart: 3.6.0
Browser: Chrome
OS: macOS 15.1.1 (darwin-arm64)
I ran flutter doctor and encountered no issues related to Flutter Web.

If you're still facing issues, you might want to check:

Browser Compatibility: Have you tested on different browsers?
CORS or Firewall Restrictions: Some network policies might block connectivity checks.
Debug Console: Any errors or warnings related to network requests?
Try a Different Approach: Consider using dart:html for network checks as an alternative.
Let me know if you need any more details. Hope this helps! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

3 participants