Browse Source

neon: relax some iterable types

pull/410/head
Nikolas Rimikis 1 year ago
parent
commit
3c148df566
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 11
      packages/neon/neon/lib/src/app.dart
  2. 2
      packages/neon/neon/lib/src/utils/settings_export_helper.dart
  3. 4
      packages/settings/lib/src/options/select_option.dart

11
packages/neon/neon/lib/src/app.dart

@ -196,13 +196,10 @@ class _NeonAppState extends State<NeonApp> 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)!);
}
}

2
packages/neon/neon/lib/src/utils/settings_export_helper.dart

@ -33,7 +33,7 @@ class SettingsExportHelper {
final accountsData = data['accounts'] as Map<String, dynamic>;
for (final accountId in accountsData.keys) {
final account = accountSpecificOptions.keys.toList().find(accountId);
final account = accountSpecificOptions.keys.find(accountId);
if (account == null) {
return;
}

4
packages/settings/lib/src/options/select_option.dart

@ -25,9 +25,9 @@ class SelectOption<T> extends Option<T> {
}
T? _fromString(final Map<T, LabelBuilder> 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;
}

Loading…
Cancel
Save