Skip to content

Commit

Permalink
style: consciness
Browse files Browse the repository at this point in the history
Expressions over statements, yeah!
  • Loading branch information
lishaduck committed Oct 16, 2023
1 parent e18f94d commit 6c83fbe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 deletions.
6 changes: 1 addition & 5 deletions lib/features/auth/data/auth_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 4 additions & 6 deletions lib/features/utils/application/banner_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Original file line number Diff line number Diff line change
Expand Up @@ -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))
};
}
}

Expand Down

0 comments on commit 6c83fbe

Please sign in to comment.