promptAvdSelection function
Prompt the user to choose an AVD
Implementation
Future<String?> promptAvdSelection(List<String> avds) async {
print('\nš± Available AVDs:\n');
for (int i = 0; i < avds.length; i++) {
print(' [${i + 1}] ${avds[i]}');
}
stdout.write('\nEnter AVD number to launch: ');
final input = stdin.readLineSync();
final index = int.tryParse(input ?? '');
if (index != null && index > 0 && index <= avds.length) {
return avds[index - 1];
}
print('ā Invalid selection.');
return null;
}