From 97853d525ed23accd66e652a498e00c5538995c0 Mon Sep 17 00:00:00 2001 From: Gurkengewuerz Date: Sun, 27 Jan 2019 21:37:06 +0100 Subject: [PATCH] added stop smartconfig --- lib/flutter_smartconfig.dart | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/flutter_smartconfig.dart b/lib/flutter_smartconfig.dart index f112232..283425e 100644 --- a/lib/flutter_smartconfig.dart +++ b/lib/flutter_smartconfig.dart @@ -7,7 +7,25 @@ import 'dart:io' show Platform; // for iOS https://github.com/lou-lan/SmartConfig class FlutterSmartconfig { - static const platform = const MethodChannel("plugins.flutter.io/flutter_smartconfig"); + static const platform = + const MethodChannel("plugins.flutter.io/flutter_smartconfig"); + + static Future stopConfigure() async { + if (Platform.isAndroid) { + try { + await platform.invokeMethod('stopSmartConfig'); + } on PlatformException catch (e) { + return Future>(() { + throw new PlatformException( + code: "Failed to get connected WiFi name: '${e.message}'."); + }); + } + } else { + return Future>(() { + throw new PlatformException(code: "only Android is supported"); + }); + } + } static Future configureEsp( {String ssid, String bssid, String password}) async {