isMicroValid static method

Future<bool?> isMicroValid()

Implementation

static Future<bool?> isMicroValid() async {
  if (Platform.isIOS) return null;
  final devices = await navigator.mediaDevices.enumerateDevices();
  final audioInput =
      devices.where((device) => device.kind == 'audioinput').toList();
  final preferMicro =
      audioInput.where((item) => item.deviceId == 'microphone-bottom');

  if (preferMicro.isNotEmpty) {
    return true;
  } else {
    return false;
  }
}