getPairedDevices method
Implementation
@override
Future<List<Map<String, String>>?> getPairedDevices() async {
try {
final List<Object?>? out = await methodChannel.invokeMethod(
'getPairedDevices',
);
if (out == null) {
return null;
}
List<Map<String, String>>? realData = [];
for (dynamic item in out) {
Map<dynamic, dynamic> map = item as Map<dynamic, dynamic>;
Map<String, String> stringMap = map.cast<String, String>();
realData.add(stringMap);
}
debugPrint("Devices got $out");
debugPrint("Devices got $realData");
return realData;
} on PlatformException catch (e) {
debugPrint("Failed: ${e.message}");
return null;
}
}