From 3c148df56683e68636e4764adbe75b2b56f50cec Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Thu, 22 Jun 2023 13:15:14 +0200 Subject: [PATCH] neon: relax some iterable types --- packages/neon/neon/lib/src/app.dart | 11 ++++------- .../neon/lib/src/utils/settings_export_helper.dart | 2 +- packages/settings/lib/src/options/select_option.dart | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/neon/neon/lib/src/app.dart b/packages/neon/neon/lib/src/app.dart index 115bc381..7e2692e6 100644 --- a/packages/neon/neon/lib/src/app.dart +++ b/packages/neon/neon/lib/src/app.dart @@ -196,13 +196,10 @@ class _NeonAppState extends State with WidgetsBindingObserver, tray.Tra exit(0); } - final matches = _appRegex.allMatches(shortcutType).toList(); - if (matches.isNotEmpty) { - final activeAccount = _accountsBloc.activeAccount.valueOrNull; - if (activeAccount == null) { - return; - } - await _openAppFromExternal(activeAccount, matches[0].group(1)!); + final matches = _appRegex.allMatches(shortcutType); + final activeAccount = _accountsBloc.activeAccount.valueOrNull; + if (matches.isNotEmpty && activeAccount != null) { + await _openAppFromExternal(activeAccount, matches.first.group(1)!); } } diff --git a/packages/neon/neon/lib/src/utils/settings_export_helper.dart b/packages/neon/neon/lib/src/utils/settings_export_helper.dart index d20be57b..91059e73 100644 --- a/packages/neon/neon/lib/src/utils/settings_export_helper.dart +++ b/packages/neon/neon/lib/src/utils/settings_export_helper.dart @@ -33,7 +33,7 @@ class SettingsExportHelper { final accountsData = data['accounts'] as Map; for (final accountId in accountsData.keys) { - final account = accountSpecificOptions.keys.toList().find(accountId); + final account = accountSpecificOptions.keys.find(accountId); if (account == null) { return; } diff --git a/packages/settings/lib/src/options/select_option.dart b/packages/settings/lib/src/options/select_option.dart index be06156a..99d07a63 100644 --- a/packages/settings/lib/src/options/select_option.dart +++ b/packages/settings/lib/src/options/select_option.dart @@ -25,9 +25,9 @@ class SelectOption extends Option { } T? _fromString(final Map vs, final String? valueStr) { - final v = vs.keys.where((final e) => e.toString() == valueStr).toList(); + final v = vs.keys.where((final e) => e.toString() == valueStr); if (v.length == 1) { - return v[0]; + return v.first; } return null; }