start method
Start advertising. Takes AdvertiseData
as an input.
Implementation
Future<BluetoothCentralState> start({
ScanSettings? scanSettings,
}) async {
if (Platform.isWindows) {
try {
await _methodChannel.invokeMethod(
'start',
(scanSettings ?? ScanSettings()).toJson(),
);
} on PlatformException catch (e) {
debugPrint('$tag platform exception: $e');
return BluetoothCentralState.turnedOff;
}
return BluetoothCentralState.ready;
}
final response = await _methodChannel.invokeMethod<int>(
'start',
(scanSettings ?? ScanSettings()).toJson(),
);
return response == null
? BluetoothCentralState.unknown
: BluetoothCentralState.values[response];
}