From 72d0e0b41ad41eae055c66f1efed620f77be40a4 Mon Sep 17 00:00:00 2001 From: Danny Tuppeny Date: Wed, 9 May 2018 07:58:07 +0100 Subject: [PATCH] Add text explaining how to run an emulator --- .../lib/src/commands/emulators.dart | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/flutter_tools/lib/src/commands/emulators.dart b/packages/flutter_tools/lib/src/commands/emulators.dart index 8a961f1d3e..be19c3419b 100644 --- a/packages/flutter_tools/lib/src/commands/emulators.dart +++ b/packages/flutter_tools/lib/src/commands/emulators.dart @@ -55,8 +55,10 @@ class EmulatorsCommand extends FlutterCommand { if (emulators.isEmpty) { printStatus("No emulator found that matches '$id'."); } else if (emulators.length > 1) { - printStatus("More than one emulator matches '$id':\n"); - Emulator.printEmulators(emulators); + _printEmulatorList( + emulators, + "More than one emulator matches '$id':", + ); } else { await emulators.first.launch(); } @@ -75,9 +77,17 @@ class EmulatorsCommand extends FlutterCommand { 'You may need to create one using Android Studio ' 'or visit https://flutter.io/setup/ for troubleshooting tips.'); } else { - printStatus( - '${emulators.length} available ${pluralize('emulator', emulators.length)}:\n'); - Emulator.printEmulators(emulators); + _printEmulatorList( + emulators, + '${emulators.length} available ${pluralize('emulator', emulators.length)}:', + ); } } + + void _printEmulatorList(List emulators, String message) { + printStatus('$message\n'); + Emulator.printEmulators(emulators); + printStatus( + "\nTo run an emulator, run 'flutter emulators --launch '."); + } }