startDiscovery static method
dynamic
startDiscovery(
- dynamic callback(
- Map discoveryType,
- List deviceList
)
)
Implementation
static startDiscovery(callback(Map discoveryType, List deviceList)) async {
if (AliIotPlugin.debug) {
print("$TAG : startDiscovery");
}
_startDiscoverySubscription = AliIotPlugin.eventChannel.receiveBroadcastStream("startDiscovery").listen((event) {
if (event != null) {
print("$TAG : startDiscovery event: " + event.toString());
if (event is Map<String, dynamic>) {
var data = jsonDecode(event["data"]);
callback(data["discoveryType"], data["deviceList"]);
}
}
});
AliIotPlugin.methodChannel.invokeMethod('startDiscovery');
}