wifi_signal_strength_indicator 1.0.7 copy "wifi_signal_strength_indicator: ^1.0.7" to clipboard
wifi_signal_strength_indicator: ^1.0.7 copied to clipboard

A Flutter package to get WiFi signal strength indicator for iOS and Android platforms. Includes visual indicator widgets with bars and WiFi arc styles.

WiFi Signal Strength #

A Flutter package to get WiFi signal strength indicator for iOS and Android platforms.

Features #

  • ✅ Get WiFi signal strength in dBm
  • ✅ Get WiFi signal level (0-4 scale)
  • ✅ Check if WiFi is connected
  • ✅ Get WiFi SSID (network name)
  • Get comprehensive WiFi signal information (dBm, frequency, SSID, BSSID, IP)
  • Stream WiFi speed (Mbps) in real-time with configurable update interval
  • Stream current network speed (download/upload) in real-time with configurable update interval
  • Visual WiFi signal strength indicator widget
  • Two visual styles: Bars and Sectors
  • Custom RSSI input support
  • ✅ Works on both iOS and Android

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  wifi_signal_strength_indicator: ^1.0.6

Then run:

flutter pub get

Platform Setup #

Android #

Add the following permissions to your android/app/src/main/AndroidManifest.xml:

<!-- Required permissions for WiFi signal strength -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />

<!-- Required for Android 10 (API 29) and above to access WiFi info (SSID, BSSID) -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<!-- Required for getting local IP address -->
<uses-permission android:name="android.permission.INTERNET" />

<!-- Optional: For Android 12 (API 31) and above, if you need to scan WiFi networks -->
<uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES" android:usesPermissionFlags="neverForLocation" />

Note:

  • For Android 10 (API 29) and above, location permission is required to access WiFi information (SSID, BSSID). Make sure to request location permissions at runtime.
  • The INTERNET permission is required for getting the local IP address.
  • The NEARBY_WIFI_DEVICES permission is optional and only needed if you plan to scan WiFi networks (not required for getting connected WiFi info).

iOS #

Add the following to your ios/Runner/Info.plist:

<!-- Required for accessing WiFi SSID on iOS 12+ -->
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs location permission to access WiFi information</string>

<!-- Optional: For iOS 13+ if you need to access WiFi info when app is in background -->
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app needs location permission to access WiFi information</string>

Note:

  • iOS requires location permissions to access WiFi SSID. The app must request location permissions at runtime.
  • For iOS 13+, accessing WiFi information (SSID, BSSID) requires special entitlements. To get full WiFi information including RSSI, BSSID, and link speed, you need to:
    1. Add the com.apple.developer.networking.wifi-info entitlement to your app's entitlements file
    2. Request the entitlement from Apple (requires special approval)
    3. Without these entitlements, only SSID (on iOS 12) and IP address are available
  • Version 1.0.6+: Fixed iOS build issues including podspec naming and Swift compiler errors. The package now builds successfully for iOS.

Usage #

Basic Example #

import 'package:wifi_signal_strength_indicator/wifi_signal_strength_indicator.dart';

// Check if WiFi is connected
final isConnected = await WifiSignalStrength.isWifiConnected();
print('WiFi connected: $isConnected');

// Get signal strength in dBm
final signalStrength = await WifiSignalStrength.getSignalStrength();
if (signalStrength != null) {
  print('Signal strength: $signalStrength dBm');
}

// Get signal level (0-4)
final signalLevel = await WifiSignalStrength.getSignalLevel();
if (signalLevel != null) {
  print('Signal level: $signalLevel/4');
}

// Get WiFi SSID
final ssid = await WifiSignalStrength.getWifiSSID();
if (ssid != null) {
  print('Connected to: $ssid');
}

// Get comprehensive WiFi signal information
final wifiInfo = await WifiSignalStrength.getWifiSignalInfo();
if (wifiInfo != null) {
  print('Signal strength: ${wifiInfo.dbm} dBm');
  print('Frequency: ${wifiInfo.frequency} MHz');
  print('SSID: ${wifiInfo.ssid}');
  print('BSSID: ${wifiInfo.bssid}');
  print('IP Address: ${wifiInfo.ip}');
}

// Stream WiFi speed updates in real-time
final speedStream = WifiSignalStrength.streamWifiSpeed(interval: Duration(seconds: 2));
speedStream.listen((speed) {
  if (speed != null) {
    print('Current WiFi speed: $speed Mbps');
  } else {
    print('WiFi not connected or speed unavailable');
  }
});

// Stream current network speed (download/upload) in real-time
final networkSpeedStream = WifiSignalStrength.streamNetworkSpeed(interval: Duration(seconds: 2));
networkSpeedStream.listen((speedInfo) {
  if (speedInfo != null) {
    print('Download: ${speedInfo.downloadSpeedMbps?.toStringAsFixed(2)} Mbps');
    print('Upload: ${speedInfo.uploadSpeedMbps?.toStringAsFixed(2)} Mbps');
    print('Download: ${speedInfo.downloadSpeedKbps?.toStringAsFixed(2)} KB/s');
    print('Upload: ${speedInfo.uploadSpeedKbps?.toStringAsFixed(2)} KB/s');
  } else {
    print('Network not available');
  }
});

Signal Level Reference #

  • 4: Excellent signal (RSSI >= -50 dBm) - Green
  • 3: Good signal (RSSI >= -60 dBm) - Light Green
  • 2: Fair signal (RSSI >= -70 dBm) - Orange
  • 1: Weak signal or no signal (RSSI < -70 dBm or null) - Deep Orange

Visual Indicator Widget #

The package includes a ready-to-use widget for displaying WiFi signal strength visually:

import 'package:flutter/material.dart';
import 'package:wifi_signal_strength_indicator/wifi_signal_strength_indicator.dart';

// Using actual WiFi signal strength (default size: 20.0)
WifiSignalStrengthIndicator(
  rssi: -55, // RSSI value from WifiSignalStrength.getSignalStrength()
  style: WifiSignalStyle.bars, // or WifiSignalStyle.sectors
  showLevel: true,
)

// With custom size
WifiSignalStrengthIndicator(
  rssi: -65, // Your custom RSSI value
  style: WifiSignalStyle.sectors,
  size: 40.0,
  showLevel: true,
)

// With static color (single color for all levels)
WifiSignalStrengthIndicator(
  rssi: -55,
  staticColor: Colors.grey, // All levels use grey
)

Note: Colors are fixed defaults (green, lightGreen, orange, deepOrange) based on signal level. Use staticColor parameter to override with a single color for all levels.

Complete Example with UI #

import 'package:flutter/material.dart';
import 'package:wifi_signal_strength_indicator/wifi_signal_strength_indicator.dart';
import 'package:wifi_signal_strength_indicator/wifi_signal_strength.dart';

class WifiStatusWidget extends StatefulWidget {
  @override
  _WifiStatusWidgetState createState() => _WifiStatusWidgetState();
}

class _WifiStatusWidgetState extends State<WifiStatusWidget> {
  int? _signalStrength;
  WifiSignalStyle _style = WifiSignalStyle.bars;

  @override
  void initState() {
    super.initState();
    _updateWifiStatus();
  }

  Future<void> _updateWifiStatus() async {
    final signalStrength = await WifiSignalStrength.getSignalStrength();
    setState(() {
      _signalStrength = signalStrength;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        WifiSignalStrengthIndicator(
          rssi: _signalStrength,
          style: _style,
          size: 40.0,
          showLevel: true,
        ),
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ElevatedButton(
              onPressed: () => setState(() => _style = WifiSignalStyle.bars),
              child: Text('Bars'),
            ),
            SizedBox(width: 16),
            ElevatedButton(
              onPressed: () => setState(() => _style = WifiSignalStyle.sectors),
              child: Text('Sectors'),
            ),
          ],
        ),
        ElevatedButton(
          onPressed: _updateWifiStatus,
          child: Text('Refresh'),
        ),
      ],
    );
  }
}

API Reference #

WifiSignalStrength.getSignalStrength() #

Returns the current WiFi signal strength in dBm.

  • Returns: Future<int?> - Signal strength in dBm (typically -100 to 0), or null if WiFi is not connected
  • Example: final strength = await WifiSignalStrength.getSignalStrength();

WifiSignalStrength.getSignalLevel() #

Returns the WiFi signal strength level on a 1-4 scale.

  • Returns: Future<int?> - Signal level (1-4), or null if WiFi is not connected
  • Example: final level = await WifiSignalStrength.getSignalLevel();

WifiSignalStrength.isWifiConnected() #

Checks if WiFi is currently connected.

  • Returns: Future<bool> - true if WiFi is connected, false otherwise
  • Example: final isConnected = await WifiSignalStrength.isWifiConnected();

WifiSignalStrength.getWifiSSID() #

Gets the current WiFi SSID (network name).

  • Returns: Future<String?> - The SSID of the connected WiFi network, or null if not connected
  • Example: final ssid = await WifiSignalStrength.getWifiSSID();

WifiSignalStrength.getWifiSignalInfo() #

Gets comprehensive WiFi signal information including dBm, frequency, SSID, BSSID, and IP address.

  • Returns: Future<WifiSignalInfo?> - A WifiSignalInfo object containing all WiFi information, or null if WiFi is not connected
  • Example:
    final info = await WifiSignalStrength.getWifiSignalInfo();
    if (info != null) {
      print('dBm: ${info.dbm}');
      print('Frequency: ${info.frequency} MHz');
      print('SSID: ${info.ssid}');
      print('BSSID: ${info.bssid}');
      print('IP: ${info.ip}');
    }
    

Note:

  • On Android, all fields are available when WiFi is connected.
  • On iOS, only ssid (iOS 12+) and ip are available without special entitlements. Other fields (dbm, frequency, bssid) require the com.apple.developer.networking.wifi-info entitlement.

WifiSignalStrength.streamWifiSpeed() #

Streams WiFi speed (Mbps) updates periodically in real-time.

  • Parameters:
    • interval: The interval between updates (default: 1 second)
  • Returns: Stream<int?> - A stream that emits WiFi speed in Mbps, or null if WiFi is not connected
  • Example:
    // Stream with default 1 second interval
    final speedStream = WifiSignalStrength.streamWifiSpeed();
      
    // Stream with custom 2 second interval
    final speedStream = WifiSignalStrength.streamWifiSpeed(interval: Duration(seconds: 2));
      
    // Listen to the stream
    final subscription = speedStream.listen((speed) {
      if (speed != null) {
        print('Current WiFi speed: $speed Mbps');
      } else {
        print('WiFi not connected');
      }
    });
      
    // Don't forget to cancel the subscription when done
    // subscription.cancel();
    

Note:

  • On Android, WiFi speed is available when WiFi is connected.
  • On iOS, WiFi speed is not available without special entitlements (com.apple.developer.networking.wifi-info), so the stream will emit null values.

WifiSignalStrengthIndicator #

A widget that displays WiFi signal strength visually.

Parameters:

  • rssi (required): The RSSI value in dBm (typically ranges from -100 to 0)
  • style: Visual style - WifiSignalStyle.bars or WifiSignalStyle.sectors (default: bars)
  • size: Size of the indicator in pixels (default: 20.0)
  • staticColor: Optional single color to use for all signal levels (overrides default colors)
  • showLevel: Whether to show the signal level number below the indicator (default: false)
  • levelTextStyle: Optional text style for the level number

Default Colors:

  • Level 4 (Excellent): Green
  • Level 3 (Good): Light Green
  • Level 2 (Fair): Orange
  • Level 1 (Weak/No signal): Deep Orange

Example:

WifiSignalStrengthIndicator(
  rssi: -55,
  style: WifiSignalStyle.bars,
  size: 40.0,
  showLevel: true,
)

Permissions #

Android #

Required Permissions:

  • ACCESS_WIFI_STATE - Required to read WiFi state and signal strength
  • ACCESS_NETWORK_STATE - Required to check network connectivity
  • ACCESS_FINE_LOCATION - Required for Android 10+ (API 29+) to access WiFi info (SSID, BSSID)
  • ACCESS_COARSE_LOCATION - Required for Android 10+ (API 29+) to access WiFi info
  • INTERNET - Required for getting local IP address

Optional Permissions:

  • NEARBY_WIFI_DEVICES - Optional, only needed for scanning WiFi networks (Android 12+)
  • CHANGE_WIFI_STATE - Optional, only needed if you want to modify WiFi state

Runtime Permissions:

  • For Android 6.0+ (API 23+), you must request ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION at runtime before accessing WiFi information.

iOS #

Required Permissions:

  • NSLocationWhenInUseUsageDescription - Required to access WiFi SSID on iOS 12+
  • Location permissions must be requested at runtime

Optional Entitlements (for advanced features):

  • com.apple.developer.networking.wifi-info - Required for iOS 13+ to access full WiFi information (RSSI, BSSID, link speed). This requires special approval from Apple.

Note: Without the WiFi info entitlement, iOS apps can only access:

  • SSID (on iOS 12, limited on iOS 13+)
  • IP address
  • WiFi connection status

Limitations #

iOS #

  • Getting actual RSSI values on iOS requires special entitlements and may not be available in all scenarios
  • WiFi SSID access requires location permissions and may be restricted on iOS 13+
  • Note: For detailed iOS compatibility information, see IOS_COMPATIBILITY.md in the package root

Android #

  • Location permissions are required for Android 10 (API 29) and above
  • Some devices may have restrictions on accessing WiFi information

Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

Support #

If you encounter any issues or have questions, please file an issue on the GitHub repository.

3
likes
140
points
340
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package to get WiFi signal strength indicator for iOS and Android platforms. Includes visual indicator widgets with bars and WiFi arc styles.

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on wifi_signal_strength_indicator

Packages that implement wifi_signal_strength_indicator