op_wifi_utils 1.2.2
op_wifi_utils: ^1.2.2 copied to clipboard
A lightweight Flutter plugin using modern Android and iOS APIs to connect to Wi-Fi, disconnect, and retrieve the current SSID, based on OpResult for structured error handling.
Changelog #
1.2.2 - 2025-04-18 #
Fixed #
- Properly unregisters the network callback in
disconnectFromWifion Android 10+ to fully release temporary Wi-Fi connections established viaWifiNetworkSpecifier. - Prevents lingering connections and ensures the system cleans up the app-bound network reliably after disconnect.
Improved #
- Strengthened
disconnectFromWifibehavior on Android by combiningbindProcessToNetwork(null)withunregisterNetworkCallbackwhen applicable, as per platform requirements for Android 10+.
1.2.1 - 2025-04-17 #
Fixed #
- Fixed a critical issue introduced in
v1.2.0whereconnectToWifion Android incorrectly returnedINVALID_PASSWORDdue to unreliable SSID validation after connection. - The plugin now trusts the system connection callback (
onAvailable) on Android 10+ and does not rely onWifiManager.connectionInfo.ssid, which may return<unknown ssid>. - Ensures proper use of
UNAVAILABLEas a general error when the connection fails without specific cause.
Added #
- New
OpWifiUtilsError.unavailableerror type to represent general connection failures on Android (e.g., network out of range, wrong password, or timeout).
1.2.0 - 2025-04-15 #
Changed #
- All
result.successandresult.errorcalls in Android native code are now wrapped inHandler(Looper.getMainLooper()).post { ... }to ensure safe main thread return. - This change improves stability and avoids potential crashes or UI threading issues across different Android versions and manufacturers.
- Also avoids blocking the main thread while waiting for platform responses, improving compatibility with Flutter's MethodChannel behavior.
1.1.0 - 2025-04-14 #
- Improved
connectToWifibehavior on iOS:- Handles iOS error code 2 (invalid password format) and maps it to
INVALID_PASSWORD. - Verifies actual connection by comparing current SSID after a short delay.
- Distinguishes
SSID_NOT_FOUNDfrom other connection issues.
- Handles iOS error code 2 (invalid password format) and maps it to
- Improved
connectToWifibehavior on Android:- After
onAvailable, verifies the actual connected SSID. - If the SSID doesn't match the expected one, returns
INVALID_PASSWORDto indicate likely credential issues.
- After
1.0.1 - 2025-04-03 #
- README and pubspec wording improved for clarity and consistency
1.0.0 - 2025-04-03 #
- Initial release 🎉
- Connect to Wi-Fi with optional password (iOS and Android)
- Disconnect from Wi-Fi network
- Check current connected SSID
- Full OpResult-based error handling
- joinOnce option supported on iOS
- Example app included for both platforms