Commit 03b5fe3d authored by Danny Tuppeny's avatar Danny Tuppeny Committed by Danny Tuppeny

Handle nulls caused by missing information

parent 1037586d
...@@ -48,11 +48,11 @@ class EmulatorManager { ...@@ -48,11 +48,11 @@ class EmulatorManager {
final List<Emulator> emulators = await getAllAvailableEmulators().toList(); final List<Emulator> emulators = await getAllAvailableEmulators().toList();
emulatorId = emulatorId.toLowerCase(); emulatorId = emulatorId.toLowerCase();
bool exactlyMatchesEmulatorId(Emulator emulator) => bool exactlyMatchesEmulatorId(Emulator emulator) =>
emulator.id.toLowerCase() == emulatorId || emulator.id?.toLowerCase() == emulatorId ||
emulator.name.toLowerCase() == emulatorId; emulator.name?.toLowerCase() == emulatorId;
bool startsWithEmulatorId(Emulator emulator) => bool startsWithEmulatorId(Emulator emulator) =>
emulator.id.toLowerCase().startsWith(emulatorId) || emulator.id?.toLowerCase()?.startsWith(emulatorId) == true ||
emulator.name.toLowerCase().startsWith(emulatorId); emulator.name?.toLowerCase()?.startsWith(emulatorId) == true;
final Emulator exactMatch = emulators.firstWhere( final Emulator exactMatch = emulators.firstWhere(
exactlyMatchesEmulatorId, orElse: () => null); exactlyMatchesEmulatorId, orElse: () => null);
...@@ -150,10 +150,10 @@ abstract class Emulator { ...@@ -150,10 +150,10 @@ abstract class Emulator {
final List<List<String>> table = <List<String>>[]; final List<List<String>> table = <List<String>>[];
for (Emulator emulator in emulators) { for (Emulator emulator in emulators) {
table.add(<String>[ table.add(<String>[
emulator.name, emulator.name ?? emulator.id ?? '',
emulator.manufacturer, emulator.manufacturer ?? '',
emulator.label, emulator.label ?? '',
emulator.id, emulator.id ?? '',
]); ]);
} }
......
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