From 6c83fbed7fb7e8a9f49c6cd67e9396c52b3610e1 Mon Sep 17 00:00:00 2001 From: Eli <88557639+lishaduck@users.noreply.github.com> Date: Mon, 16 Oct 2023 16:37:29 -0500 Subject: [PATCH] style: consciness Expressions over statements, yeah! --- lib/features/auth/data/auth_repository.dart | 6 +----- .../utils/application/banner_service.dart | 10 ++++----- .../device_info/device_info_dialog.dart | 21 +++++++------------ 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/lib/features/auth/data/auth_repository.dart b/lib/features/auth/data/auth_repository.dart index d4c07d5d..611750fa 100644 --- a/lib/features/auth/data/auth_repository.dart +++ b/lib/features/auth/data/auth_repository.dart @@ -65,11 +65,7 @@ base class _AppwriteAuthRepository implements AuthRepository { provider: "google", ); // TODO(lishaduck): The web needs different behavior than that of linux/mac/windows. - case Device.web: - case Device.linux: - case Device.macos: - case Device.windows: - case Device.other: + case _: await _account.createOAuth2Session( provider: "google", success: "${Uri.base.origin}/auth.html", diff --git a/lib/features/utils/application/banner_service.dart b/lib/features/utils/application/banner_service.dart index 69ff923d..6cd864d0 100644 --- a/lib/features/utils/application/banner_service.dart +++ b/lib/features/utils/application/banner_service.dart @@ -10,9 +10,7 @@ part "banner_service.g.dart"; /// Get the banner's current state. @riverpod -BannerConfig bannerConfig(BannerConfigRef ref) { - return BannerConfig( - name: buildMode.name, - color: buildMode.color, - ); -} +BannerConfig bannerConfig(BannerConfigRef ref) => BannerConfig( + name: buildMode.name, + color: buildMode.color, + ); diff --git a/lib/features/utils/presentation/device_info/device_info_dialog.dart b/lib/features/utils/presentation/device_info/device_info_dialog.dart index 4249ea4e..0f40da2e 100644 --- a/lib/features/utils/presentation/device_info/device_info_dialog.dart +++ b/lib/features/utils/presentation/device_info/device_info_dialog.dart @@ -75,25 +75,20 @@ class _GetContent extends ConsumerWidget { final deviceInfo = ref.watch(deviceInfoProvider); final l10n = context.l10n; - switch (deviceInfo) { - case AsyncData(:final value): - return _View(value: value); - case AsyncLoading(): - return Center( + return switch (deviceInfo) { + AsyncData(:final value) => _View(value: value), + AsyncLoading() => Center( child: Column( children: [ const CircularProgressIndicator(), Text(l10n.loading), ], ), - ); - case AsyncError(:final error, :final stackTrace): - final message = l10n.error("$error, $stackTrace."); - - return Text(message); - case _: - return Text(l10n.error(l10n.unknownState)); - } + ), + AsyncError(:final error, :final stackTrace) => + Text(l10n.error("$error, $stackTrace.")), + _ => Text(l10n.error(l10n.unknownState)) + }; } }