getDevice method

  1. @override
Future<BluetoothDevice?> getDevice(
  1. String deviceId
)
override

实现 FlutterBluetoothPluginPlatform.getDevice

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

Implementation

@override
Future<BluetoothDevice?> getDevice(String deviceId) async {
  final response = await methodChannel.invokeMapMethod<String, dynamic>(
    'getDevice',
    <String, dynamic>{'deviceId': deviceId},
  );
  if (response == null || response.isEmpty) {
    return null;
  }
  return BluetoothDevice.fromMap(response);
}