fluttercommunity / fluttercommunity/plus_plugins

[Bug]: network_info_plus Linux getWifiSubmask wrong for /22

Open
#3,941 2 comments 1 reaction 0 assignees View on GitHub
bug triage
Dominant language
Dart
Stars
1.9k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

### Platform

Linux Ubuntu

### Plugin

network_info_plus

### Version

8.2.1

### Flutter SDK

3.44.2

### Steps to reproduce

### Preconditions
1. Linux Desktop
2. Wi-Fi on a network whose prefix is not /8, /16 or /24 (I.e. Deco /22 -> mask `255.255.252.0`)

### Steps
1. Confirm the real mask from the OS:
```
ip -4 addr show
```
Expect something like: `inet 192.168.68.x/22 `→ mask `255.255.252.0`.

Run a Flutter Linux app that calls:
```dart
final info = NetworkInfo();
print(await info.getWifiIP());
print(await info.getWifiSubmask());
```

### Expected
getWifiSubmask() → 255.255.252.0 (same as /22)

### Actual
getWifiSubmask() → 255.255.63.0

### Code Sample

```dart
final info = NetworkInfo();
print(await info.getWifiIP());
print(await info.getWifiSubmask());
```

### Logs

```shell
N/A
```

### Flutter Doctor

```shell
flutter doctor -v
[✓] Flutter (Channel stable, 3.44.2, on Ubuntu 26.04 LTS 7.0.0-28-generic, locale en_US.UTF-8) [54ms]
• Flutter version 3.44.2 on channel stable at /home/redge/fvm/versions/3.44.2
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c9a6c48423 (7 weeks ago), 2026-06-10 15:52:41 -0700
• Engine revision 77e2e94772
• Dart version 3.12.2
• DevTools version 2.57.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios,
cli-animations, enable-native-assets, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging,
enable-uiscene-migration

[✗] Android toolchain - develop for Android devices [71ms]
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/to/linux-android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome) [20ms]
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Linux toolchain - develop for Linux desktop [407ms]
• Ubuntu clang version 21.1.8 (6ubuntu1)
• cmake version 4.2.3
• ninja version 1.13.2
• pkg-config version 2.5.1
! Unable to access driver information using 'eglinfo'.
It is likely available from your distribution (e.g.: apt install mesa-utils)

[✓] Connected device (1 available) [187ms]
• Linux (desktop) • linux • linux-x64 • Ubuntu 26.04 LTS 7.0.0-28-generic

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

### 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

Contributor guide

Open the contributing guide

Research direction

Start at the Linux implementation of NetworkInfo.getWifiSubmask and compare its handling of the prefix reported by `ip -4 addr show`. Reproduce the issue on a /22 network and verify that the method returns 255.255.252.0 rather than 255.255.63.0; done means the reported subnet mask matches the OS value.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.