discoverServices method

  1. @override
Future<List<BluetoothGattService>> discoverServices(
  1. String deviceId
)
override

实现 FlutterBluetoothPluginPlatform.discoverServices

参数、默认值、平台差异和推荐值见平台接口文档。

Implementation

@override
Future<List<BluetoothGattService>> discoverServices(String deviceId) async {
  final response = await methodChannel.invokeListMethod<dynamic>(
    'discoverServices',
    <String, dynamic>{'deviceId': deviceId},
  );
  return (response ?? const <dynamic>[])
      .map((item) => BluetoothGattService.fromMap(_asStringMap(item)))
      .toList(growable: false);
}