getCurrentDevice method Null safety

Future<Map?> getCurrentDevice(
  1. int type
)

获取当前使用的设备

注意:此接口只支持Mac和Windows平台

参数:

type 设备类型,指定需要获取哪种设备的列表。详见TXMediaDeviceType定义,type 只支持 TXMediaDeviceTypeMic、TXMediaDeviceTypeSpeaker、TXMediaDeviceTypeCamera。 deviceId 从 getDevicesList 中得到的设备 ID

返回:

ITRTCDeviceInfo 设备信息,能获取设备 ID 和设备名称

Implementation

Future<Map?> getCurrentDevice(int type) async {
  if (kIsWeb) {
    Map retrunObj = jsonDecode(
        await _channel.invokeMethod('getCurrentDevice', {"type": type}));
    return Future.value(retrunObj);
  }
  return _channel.invokeMethod('getCurrentDevice', {"type": type});
}