searchDevices static method
Implementation
static Future<List<BrotherDevice>> searchDevices({
int delay = 5,
bool searchOnIPv6 = false,
}) async {
assert(delay > 0);
List<String> printerNames;
if (Platform.isIOS) {
printerNames = brotherModels.map((x) => x.nameIOS).toList();
} else if (Platform.isAndroid) {
printerNames = brotherModels.map((x) => x.nameAndroid).toList();
} else {
throw UnimplementedError();
}
final List rawDevices = await _channel.invokeMethod('searchDevices', {
'delay': delay,
'isEnableIPv6Search': searchOnIPv6,
'printerNames': printerNames,
});
final devices = rawDevices.map((x) => Map<String, String?>.from(x)).map((x) => BrotherDevice.fromJson(x)).whereType<BrotherDevice>().toList();
return devices.toSet().toList();
}