scanForDevice method
Implementation
Stream<ScannedDevice> scanForDevice(DeviceModel deviceModel) {
return Stream.fromFuture(
_checkPermissions().then(
(value) => _channel.invokeMethod('startScanForDevice', [
deviceModel.id,
deviceModel.name,
deviceModel.brand.name,
deviceModel.kind.name
]),
),
).flatMap((outcome) {
if (outcome == null) {
return _scanSubject;
} else {
throw UnknownException("Could not start scan: $outcome");
}
});
}