scanDevices method
Stream<BluetoothDevice>
scanDevices(
- String? name,
- List<
String> withServices, - ManufacturerSpecificData? manufacturerSpecificData
override
Implementation
@override
Stream<BluetoothDevice> scanDevices(String? name, List<String> withServices,
ManufacturerSpecificData? manufacturerSpecificData) async* {
const events = EventChannel("scan_blep");
var arguments = {'name': name, 'withServices': withServices};
if (manufacturerSpecificData != null) {
arguments.addAll({
'manufacturerId': manufacturerSpecificData.id,
'manufacturerData': manufacturerSpecificData.data,
});
}
await methodChannel.invokeMethod('scanDevices', arguments);
yield* events.receiveBroadcastStream().map((deviceData) =>
BluetoothDevice(name: deviceData['name'], id: deviceData['id'], manufacturerId: deviceData['manufacturerId']));
}