Skip to content

Conversation

@Hovirix
Copy link

@Hovirix Hovirix commented Jan 17, 2026

Description

On Linux systems where NetworkManager is not installed or not running,
connectivity_plus crashes with an uncaught DBus exception during startup.

This affects applications such as AppFlowy and any Flutter Linux app running on:

  • NixOS without networkmanager (my case)
  • Minimal or containerized distributions
  • Systems using alternative network managers (e.g. systemd-networkd, ConnMan)
  • Systems where NetworkManager is intentionally disabled

Instead of failing gracefully, the plugin throws an uncaught platform error from DBus
and terminates the app.

What this PR changes

  • Wrap NetworkManager / DBus calls in try-catch blocks in:
    • checkConnectivity()
    • _startListenConnectivity()
  • Treat missing or unavailable NetworkManager as a non-fatal condition
  • Return ConnectivityResult.none when NetworkManager cannot be accessed
  • Add inline documentation explaining why graceful degradation is required on Linux
  • Add unit tests covering NetworkManager-unavailable scenarios

This ensures the plugin works correctly across all Linux distributions,
regardless of their network management infrastructure.


Expected Behavior After This Change

  • Flutter Linux apps do not crash when NetworkManager is missing
  • Connectivity is reported as ConnectivityResult.none instead of throwing
  • Behavior matches other platforms where connectivity may be temporarily unavailable

Related Issues


Checklist

  • I read the Contributor Guide and followed the process outlined there
  • The PR title follows Conventional Commits
  • I did not modify CHANGELOG.md or plugin versions
  • All existing and new tests pass
  • flutter analyze reports no issues

Breaking Change

  • Yes
  • No

This change only affects error handling and does not modify public APIs or
expected return types.

…ble on Linux

When NetworkManager is not installed or running on Linux systems, the plugin
would crash with an uncaught DBus exception. This affected apps like AppFlowy
and others on distributions without NetworkManager or with it disabled.

Changes:
- Add try-catch blocks to checkConnectivity() and _startListenConnectivity()
- Return ConnectivityResult.none when NetworkManager is unavailable
- Add explanatory comments about graceful degradation
- Add unit tests for NetworkManager unavailable scenarios

This ensures the plugin works on all Linux distributions regardless of their
network management infrastructure, treating missing NetworkManager as an
offline/unknown connectivity state rather than a fatal error.

Fixes crashes on NixOS, minimal distributions, and systems with NetworkManager
disabled or using alternative network managers (systemd-networkd, ConnMan, etc).
@Hovirix Hovirix closed this Jan 17, 2026
@Hovirix Hovirix reopened this Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Linux crash when NetworkManager is not present

1 participant