Connect to Wifi using Flutter

7.8k Views Asked by At

I'm working on a Flutter project that needs to connect to a certain wifi by entering username and password.

I'm using wifi_configuration package which I can connect to a wifi by entering the SSID and password.

Is there any other way to connect to wifi using username and password in Flutter?

1

There are 1 best solutions below

2
On

If connecting to wifi requires signing-in through a webpage from the browser, then it's not possible to be done through Flutter. Plugins available can only connect you through the SSID with a password. Aside from wifi_configuration, there are other options like wifi_connect plugin.

await WifiConnect.connect(
  context,
  ssid: ssidControl.text,
  password: passwordControl.text,
  hidden: hidden,
  securityType: hidden ? SecurityType.wpa : SecurityType.auto,
);

Where ssidControl and passwordControl can be set on TextField widgets to configure the wifi password.

TextField(
  controller: ssidControl,
  decoration: InputDecoration(labelText: 'SSID'),
),
TextField(
  controller: passwordControl,
  decoration: InputDecoration(labelText: 'Password'),
),