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 {
} else {
printStatus(
'${emulators.length} available ${pluralize('emulator', emulators.length)}:\n');
await Emulator.printEmulators(emulators);
Emulator.printEmulators(emulators);
}
}
}
......@@ -102,9 +102,9 @@ abstract class Emulator {
@override
String toString() => name;
static Stream<String> descriptions(List<Emulator> emulators) async* {
static List<String> descriptions(List<Emulator> emulators) {
if (emulators.isEmpty)
return;
return <String>[];
// Extract emulators information
final List<List<String>> table = <List<String>>[];
......@@ -125,12 +125,14 @@ abstract class Emulator {
}
// Join columns into lines of text
for (List<String> row in table) {
yield indices.map((int i) => row[i].padRight(widths[i])).join(' • ') + ' • ${row.last}';
}
return table.map((List<String> row) {
return indices
.map((int i) => row[i].padRight(widths[i]))
.join(' • ') + ' • ${row.last}';
}).toList();
}
static Future<Null> printEmulators(List<Emulator> emulators) async {
await descriptions(emulators).forEach(printStatus);
static void printEmulators(List<Emulator> emulators) {
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