Connect To A Specific Wifi Network In Flutter Dart

wifi_configuration_2: ^1.1.2+1
$ flutter pub add wifi_configuration_2
import 'package:wifi_configuration_2/wifi_configuration_2.dart';
<uses-permission          android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-feature android:name="android.hardware.wifi" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
await wifiConfiguration.isWifiEnabled();
await wifiConfiguration!.connectToWifi("SSID name", "password","your application package name here...");
// enable wifienableWifi() {
wifiConfiguration.enableWifi();
}
// disable wifidisableWifi() {
wifiConfiguration.disableWifi();
}

--

--

--

Flutter || Android Developer Since 2018

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What divides Software & Hardware

Technologist Spotlight: Bill Phung

#100daysAppChallenge Introduction

Using Vapid for Web Push Notifications in a Ruby on Rails Application

AndroidStaggeredGrid

What is IBM Rational Functional Tester? Should You Be Using It?

Help! My swagger controllers all return a 404 in .NET 6

BETA DAILY REPORT OF MAY 3rd: Leaderboard & Lucky Winners

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Akshay Papneja

Akshay Papneja

Flutter || Android Developer Since 2018

More from Medium

Flutter — Build fails in Samsung phone , Permission Denial

How to use flutter_localizations in FlutLab

If and ElseIf| Flutter | Dart

CustomScrollView in Flutter