changeToRoute method

Future<void> changeToRoute({
  1. required AudioDevice input,
})

Implementation

Future<void> changeToRoute({required AudioDevice input}) async {
  bool result = false;
  print('changeToRoute input = $input');
  if (checkDeviceIsHeadphone(device: input)) {
    result = await switchToHeadphones();
    if (kDebugMode) {
      print('Change to Headphone with result = $result');
    }
  } else if (checkDeviceIsBluetooth(device: input)) {
    result = await switchToBluetooth();
    if (kDebugMode) {
      print('Change to Bluetooth with result = $result');
    }
  } else if (checkDeviceIsEarpiece(device: input)) {
    result = await switchToEarpiece();
    if (kDebugMode) {
      print('Change to earpiece with result = $result');
    }
  } else if (checkDeviceIsSpeaker(device: input)) {
    result = await switchToSpeaker();
    if (kDebugMode) {
      print('Change to Speaker with result = $result');
    }
  }
  await _getInput();
}