搜索插件、代码仓与 APP 分类

GitHub 代码仓RohitKumarMishra/wifi_configuration

wifi_configuration

RohitKumarMishra/wifi_configuration open-source repository details.

wifi_configuration 项目封面
星标
7
复刻
20
最近推送(UTC)
2026年9月13日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

wifi_configuration

Connect a Flutter app to a Wi-Fi network, read the current SSID, and list available networks on Android and iOS.

This is a Dart 3 rewrite of wifi_configuration 1.2.1. The Dart API is the same (connectToWifi, getWifiList, isConnectedToWifi, connectedToWifi).

Install

dependencies:
  wifi_configuration: ^2.0.0

Usage

import 'package:wifi_configuration/wifi_configuration.dart';

final WifiConnectionStatus status = await WifiConfiguration.connectToWifi(
  'OfficeNet',
  'passphrase',
);

switch (status) {
  case WifiConnectionStatus.connected:
  case WifiConnectionStatus.alreadyConnected:
    break;
  case WifiConnectionStatus.locationNotAllowed:
    // Ask the user to enable location / grant permission.
    break;
  default:
    break;
}

final List<String> nearby = await WifiConfiguration.getWifiList();
final String current = await WifiConfiguration.connectedToWifi();
final bool matches = await WifiConfiguration.isConnectedToWifi('OfficeNet');

packageName from 1.x is still accepted as an optional third argument and is ignored on current Android/iOS.

Platform notes

Android

Add nothing extra in most apps — the plugin manifest already requests:

  • ACCESS_FINE_LOCATION / ACCESS_COARSE_LOCATION
  • NEARBY_WIFI_DEVICES (Android 13+)
  • Wi-Fi and network state permissions

Location must be on. On Android 10+ the OS shows a system dialog to join the network (WifiNetworkSpecifier). That join is app-scoped and may not appear as a saved system network.

iOS

In Xcode, enable:

  1. Hotspot Configuration
  2. Access Wi-Fi Information
  3. Link NetworkExtension.framework

And in Info.plist:

<key>NSLocationWhenInUseUsageDescription</key>
<string>Location is used to read the current Wi-Fi name and join a network.</string>

Apple does not allow scanning nearby Wi-Fi. getWifiList() returns SSIDs this app has configured, not every hotspot in range.

Status values

Value Meaning
connected Joined the requested SSID
alreadyConnected Already on that SSID
notConnected Join failed or was cancelled
platformNotSupported OS version cannot configure Wi-Fi
profileAlreadyInstalled iOS already has a profile for this SSID
locationNotAllowed Location permission or services denied

Example

See the example/ app for a small UI that lists networks, shows the current SSID, and connects with a passphrase.

RohitKumarMishra GitHub avatar
语言KotlinDartSwiftRubyObjective-C

此仓库发布的插件

使用的依赖

依赖清单 4 项

  • flutter{"sdk":"flutter"}
  • plugin_platform_interface^2.0.2
  • flutter_test开发依赖{"sdk":"flutter"}
  • flutter_lints开发依赖^6.0.0

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗