Browse Source

Merge pull request #410 from Leptopoda/cleanup/iterable

neon: relax some iterable types
pull/412/head
Nikolas Rimikis 2 years ago committed by GitHub
parent
commit
35988bee91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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); exit(0);
} }
final matches = _appRegex.allMatches(shortcutType).toList(); final matches = _appRegex.allMatches(shortcutType);
if (matches.isNotEmpty) { final activeAccount = _accountsBloc.activeAccount.valueOrNull;
final activeAccount = _accountsBloc.activeAccount.valueOrNull; if (matches.isNotEmpty && activeAccount != null) {
if (activeAccount == null) { await _openAppFromExternal(activeAccount, matches.first.group(1)!);
return;
}
await _openAppFromExternal(activeAccount, matches[0].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>; final accountsData = data['accounts'] as Map<String, dynamic>;
for (final accountId in accountsData.keys) { for (final accountId in accountsData.keys) {
final account = accountSpecificOptions.keys.toList().find(accountId); final account = accountSpecificOptions.keys.find(accountId);
if (account == null) { if (account == null) {
return; 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) { 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) { if (v.length == 1) {
return v[0]; return v.first;
} }
return null; return null;
} }

Loading…
Cancel
Save