From 1fdcba69150600504a991b06d381be98f87639c1 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Thu, 22 Jun 2023 20:49:36 +0200 Subject: [PATCH] neon: use expand instead of reduce --- packages/neon/neon/lib/src/app.dart | 2 +- packages/neon/neon/lib/src/utils/localizations.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/neon/neon/lib/src/app.dart b/packages/neon/neon/lib/src/app.dart index 7e2692e6..db9253bc 100644 --- a/packages/neon/neon/lib/src/app.dart +++ b/packages/neon/neon/lib/src/app.dart @@ -273,7 +273,7 @@ class _NeonAppState extends State with WidgetsBindingObserver, tray.Tra supportedLocales: { ..._appImplementations .map((final app) => app.supportedLocales) - .reduce((final value, final element) => [...value, ...element]), + .expand((final element) => element), ...AppLocalizations.supportedLocales, }, themeMode: themeMode, diff --git a/packages/neon/neon/lib/src/utils/localizations.dart b/packages/neon/neon/lib/src/utils/localizations.dart index 3f04cad6..d3a3cdf8 100644 --- a/packages/neon/neon/lib/src/utils/localizations.dart +++ b/packages/neon/neon/lib/src/utils/localizations.dart @@ -5,7 +5,7 @@ part of '../../neon.dart'; /// When the system locale is not supported [fallbackLocale] will be used. Future appLocalizationsFromSystem([final Locale fallbackLocale = const Locale('en', 'US')]) async { final systemLocale = await findSystemLocale(); - final parts = systemLocale.split('_').map((final a) => a.split('.')).reduce((final a, final b) => [...a, ...b]); + final parts = systemLocale.split('_').map((final a) => a.split('.')).expand((final e) => e).toList(); final locale = Locale(parts[0], parts.length > 1 ? parts[1] : null); final isSupported = AppLocalizations.delegate.isSupported(locale);