Commit 76815fae authored by Danny Tuppeny's avatar Danny Tuppeny Committed by Danny Tuppeny

Flatten descriptions from Stream to List

parent b5a3d26f
...@@ -74,7 +74,7 @@ class EmulatorsCommand extends FlutterCommand { ...@@ -74,7 +74,7 @@ class EmulatorsCommand extends FlutterCommand {
} else { } else {
printStatus( printStatus(
'${emulators.length} available ${pluralize('emulator', emulators.length)}:\n'); '${emulators.length} available ${pluralize('emulator', emulators.length)}:\n');
await Emulator.printEmulators(emulators); Emulator.printEmulators(emulators);
} }
} }
} }
...@@ -102,9 +102,9 @@ abstract class Emulator { ...@@ -102,9 +102,9 @@ abstract class Emulator {
@override @override
String toString() => name; String toString() => name;
static Stream<String> descriptions(List<Emulator> emulators) async* { static List<String> descriptions(List<Emulator> emulators) {
if (emulators.isEmpty) if (emulators.isEmpty)
return; return <String>[];
// Extract emulators information // Extract emulators information
final List<List<String>> table = <List<String>>[]; final List<List<String>> table = <List<String>>[];
...@@ -125,12 +125,14 @@ abstract class Emulator { ...@@ -125,12 +125,14 @@ abstract class Emulator {
} }
// Join columns into lines of text // Join columns into lines of text
for (List<String> row in table) { return table.map((List<String> row) {
yield indices.map((int i) => row[i].padRight(widths[i])).join(' • ') + ' • ${row.last}'; return indices
} .map((int i) => row[i].padRight(widths[i]))
.join(' • ') + ' • ${row.last}';
}).toList();
} }
static Future<Null> printEmulators(List<Emulator> emulators) async { static void printEmulators(List<Emulator> emulators) {
await descriptions(emulators).forEach(printStatus); descriptions(emulators).forEach(printStatus);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment