startDiscovery static method
Implementation
static Future<bool> startDiscovery({
required Function(List<TVDevice>) onDevices,
}) async {
channel.setMethodCallHandler((call) async {
if (call.method == 'devicesDiscovered') {
final list = (call.arguments as List)
.map((e) => TVDevice.fromMap(Map<String, dynamic>.from(e)))
.toList();
onDevices(list);
}
});
final res = await channel.invokeMethod('startDiscovery');
return (res as Map)['success'] == true;
}