Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add wrapped cache and service orchestration

Laurens204a1a674846
diff --git a/mobile/apps/photos/.docs/ente_wrapped_2025_spec.md b/mobile/apps/photos/.docs/ente_wrapped_2025_spec.md
index 36b21495f7..9546731ec1 100644
--- a/mobile/apps/photos/.docs/ente_wrapped_2025_spec.md
+++ b/mobile/apps/photos/.docs/ente_wrapped_2025_spec.md
@@ -315,7 +315,7 @@ Phase 3 β€” Advanced
- [x] Create `lib/services/wrapped/wrapped_engine.dart` with isolate compute stub
- [x] Implement candidate builders (stats, people, places, aesthetics, curation, narrative)
- [x] Wire feature flag getter (`flagService.enteWrapped`)
-- [x] Introduce `WrappedStateService` for entry gating
+- [x] Introduce `WrappedService` for entry gating
- [ ] Flesh out candidate builder implementations
- [x] StatsCandidateBuilder
- [ ] PeopleCandidateBuilder
@@ -324,7 +324,8 @@ Phase 3 β€” Advanced
- [ ] CurationCandidateBuilder
- [ ] NarrativeCandidateBuilder
- [ ] Add selection/diversity + badge logic
-- [ ] Add `WrappedCacheService` (file-based JSON) + invalidation hooks
+- [x] Add `WrappedCacheService` (file-based JSON) + invalidation hooks
+- [x] Add startup orchestration in wrapped service + debug recompute hook
- [x] Add LocalSettings extension for resume/complete
- [ ] Add Home Banner widget + wiring in gallery (gated)
- [ ] Add Discovery entry + gating + expiry window
diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dart
index 3c0a3556b9..a348f4b3ed 100644
--- a/mobile/apps/photos/lib/main.dart
+++ b/mobile/apps/photos/lib/main.dart
@@ -295,6 +295,7 @@ Future<void> _init(bool isBackground, {String via = ''}) async {
unawaited(MLService.instance.init());
await PersonService.init(entityService, MLDataDB.instance, preferences);
EnteWakeLockService.instance.init(preferences);
+ wrappedService.scheduleInitialLoad();
logLocalSettings();
initComplete = true;
_stopHearBeat = true;
diff --git a/mobile/apps/photos/lib/service_locator.dart b/mobile/apps/photos/lib/service_locator.dart
index 77b09ccb54..ab09d0dd70 100644
--- a/mobile/apps/photos/lib/service_locator.dart
+++ b/mobile/apps/photos/lib/service_locator.dart
@@ -21,7 +21,8 @@ import "package:photos/services/storage_bonus_service.dart";
import "package:photos/services/sync/trash_sync_service.dart";
import "package:photos/services/text_embeddings_cache_service.dart";
import "package:photos/services/update_service.dart";
-import "package:photos/services/wrapped/wrapped_state_service.dart";
+import "package:photos/services/wrapped/wrapped_cache_service.dart";
+import "package:photos/services/wrapped/wrapped_service.dart";
import "package:photos/utils/local_settings.dart";
import "package:shared_preferences/shared_preferences.dart";
@@ -199,8 +200,14 @@ CollectionsService get collectionsService {
return _collectionsService!;
}
-WrappedStateService? _wrappedStateService;
-WrappedStateService get wrappedStateService {
- _wrappedStateService ??= WrappedStateService.instance;
- return _wrappedStateService!;
+WrappedService? _wrappedService;
+WrappedService get wrappedService {
+ _wrappedService ??= WrappedService.instance;
+ return _wrappedService!;
+}
+
+WrappedCacheService? _wrappedCacheService;
+WrappedCacheService get wrappedCacheService {
+ _wrappedCacheService ??= WrappedCacheService.instance;
+ return _wrappedCacheService!;
}
diff --git a/mobile/apps/photos/lib/services/wrapped/models.dart b/mobile/apps/photos/lib/services/wrapped/models.dart
index db5ce087f7..2eee2c68eb 100644
--- a/mobile/apps/photos/lib/services/wrapped/models.dart
+++ b/mobile/apps/photos/lib/services/wrapped/models.dart
@@ -1,3 +1,5 @@
+import "dart:convert";
+
import "package:flutter/foundation.dart" show immutable;
@immutable
@@ -11,6 +13,44 @@ class WrappedResult {
final List<WrappedCard> cards;
final int year;
final String? badgeKey;
+
+ Map<String, Object?> toJson() {
+ return <String, Object?>{
+ "year": year,
+ "badgeKey": badgeKey,
+ "cards": cards.map((WrappedCard card) => card.toJson()).toList(),
+ };
+ }
+
+ static WrappedResult fromJson(Map<String, Object?> json) {
+ final List<dynamic> rawCards = json["cards"] as List<dynamic>? ?? const [];
+ return WrappedResult(
+ cards: rawCards
+ .map(
+ (dynamic entry) =>
+ WrappedCard.fromJson((entry as Map).cast<String, Object?>()),
+ )
+ .toList(growable: false),
+ year: json["year"] as int? ?? DateTime.now().year,
+ badgeKey: json["badgeKey"] as String?,
+ );
+ }
+
+ static WrappedResult? decode(String source) {
+ if (source.isEmpty) {
+ return null;
+ }
+ final Object? decoded = jsonDecode(source);
+ if (decoded is! Map) {
+ return null;
+ }
+ final Map<String, Object?> data = Map<String, Object?>.from(decoded);
+ return WrappedResult.fromJson(data);
+ }
+
+ String encode() {
+ return jsonEncode(toJson());
+ }
}
@immutable
@@ -29,6 +69,43 @@ class WrappedCard {
final String? subtitle;
final List<MediaRef> media;
final Map<String, Object?> meta;
+
+ Map<String, Object?> toJson() {
+ return <String, Object?>{
+ "type": type.name,
+ "title": title,
+ "subtitle": subtitle,
+ "media": media.map((MediaRef ref) => ref.toJson()).toList(),
+ "meta": meta,
+ };
+ }
+
+ static WrappedCard fromJson(Map<String, Object?> json) {
+ final String? typeName = json["type"] as String?;
+ final WrappedCardType cardType = WrappedCardType.values.firstWhere(
+ (WrappedCardType value) => value.name == typeName,
+ orElse: () => WrappedCardType.statsTotals,
+ );
+
+ final List<dynamic> rawMedia = json["media"] as List<dynamic>? ?? const [];
+ final List<MediaRef> mediaRefs = rawMedia
+ .map(
+ (dynamic entry) =>
+ MediaRef.fromJson((entry as Map).cast<String, Object?>()),
+ )
+ .toList(growable: false);
+
+ final Map<String, Object?> meta =
+ (json["meta"] as Map?)?.cast<String, Object?>() ?? <String, Object?>{};
+
+ return WrappedCard(
+ type: cardType,
+ title: json["title"] as String? ?? "",
+ subtitle: json["subtitle"] as String?,
+ media: mediaRefs,
+ meta: meta,
+ );
+ }
}
@immutable
@@ -36,6 +113,14 @@ class MediaRef {
const MediaRef(this.uploadedFileID);
final int uploadedFileID;
+
+ Map<String, Object?> toJson() {
+ return <String, Object?>{"uploadedFileID": uploadedFileID};
+ }
+
+ static MediaRef fromJson(Map<String, Object?> json) {
+ return MediaRef(json["uploadedFileID"] as int? ?? 0);
+ }
}
enum WrappedCardType {
diff --git a/mobile/apps/photos/lib/services/wrapped/wrapped_cache_service.dart b/mobile/apps/photos/lib/services/wrapped/wrapped_cache_service.dart
new file mode 100644
index 0000000000..a2abc57ed6
--- /dev/null
+++ b/mobile/apps/photos/lib/services/wrapped/wrapped_cache_service.dart
@@ -0,0 +1,110 @@
+import "dart:async";
+import "dart:io";
+
+import "package:logging/logging.dart";
+import "package:path/path.dart" as path;
+import "package:path_provider/path_provider.dart";
+import "package:photos/services/wrapped/models.dart";
+import "package:synchronized/synchronized.dart";
+
+/// Persists Wrapped results to disk so we can avoid recomputing on every boot.
+class WrappedCacheService {
+ WrappedCacheService._();
+
+ static final WrappedCacheService instance = WrappedCacheService._();
+
+ final Logger _logger = Logger("WrappedCacheService");
+ final Lock _lock = Lock();
+
+ Directory? _cacheDirectory;
+
+ Future<Directory> _ensureCacheDirectory() async {
+ if (_cacheDirectory != null) {
+ return _cacheDirectory!;
+ }
+ final Directory baseDir = await getApplicationSupportDirectory();
+ final Directory directory =
+ Directory(path.join(baseDir.path, "wrapped_cache"));
+ if (!await directory.exists()) {
+ await directory.create(recursive: true);
+ }
+ _cacheDirectory = directory;
+ return directory;
+ }
+
+ Future<File> _cacheFileForYear(int year) async {
+ final Directory directory = await _ensureCacheDirectory();
+ return File(path.join(directory.path, "$year.json"));
+ }
+
+ Future<WrappedResult?> read({required int year}) {
+ return _lock.synchronized(() async {
+ final File file = await _cacheFileForYear(year);
+ if (!await file.exists()) {
+ _logger.fine("No Wrapped cache found for $year at ${file.path}");
+ return null;
+ }
+ try {
+ final String contents = await file.readAsString();
+ final WrappedResult? result = WrappedResult.decode(contents);
+ if (result == null) {
+ _logger.warning(
+ "Failed to decode Wrapped cache for $year, deleting stale file",
+ );
+ await file.delete();
+ return null;
+ }
+ _logger.info(
+ "Loaded Wrapped cache for $year with ${result.cards.length} cards",
+ );
+ return result;
+ } catch (error, stackTrace) {
+ _logger.severe(
+ "Error reading Wrapped cache for $year",
+ error,
+ stackTrace,
+ );
+ try {
+ await file.delete();
+ } catch (_) {}
+ return null;
+ }
+ });
+ }
+
+ Future<void> write({required WrappedResult result}) {
+ return _lock.synchronized(() async {
+ final File file = await _cacheFileForYear(result.year);
+ try {
+ await file.writeAsString(result.encode(), flush: true);
+ _logger.info(
+ "Persisted Wrapped cache for ${result.year} at ${file.path}",
+ );
+ } catch (error, stackTrace) {
+ _logger.severe(
+ "Failed to persist Wrapped cache for ${result.year}",
+ error,
+ stackTrace,
+ );
+ }
+ });
+ }
+
+ Future<void> clear({required int year}) {
+ return _lock.synchronized(() async {
+ final File file = await _cacheFileForYear(year);
+ if (await file.exists()) {
+ try {
+ await file.delete();
+ _logger.info("Deleted Wrapped cache for $year at ${file.path}");
+ } catch (error, stackTrace) {
+ _logger.warning(
+ "Failed to delete Wrapped cache for $year",
+ error,
+ stackTrace,
+ );
+ }
+ }
+ });
+ }
+}
diff --git a/mobile/apps/photos/lib/services/wrapped/wrapped_state_service.dart b/mobile/apps/photos/lib/services/wrapped/wrapped_service.dart
similarity index 52%
rename from mobile/apps/photos/lib/services/wrapped/wrapped_state_service.dart
rename to mobile/apps/photos/lib/services/wrapped/wrapped_service.dart
index 2171a0f6e8..aa4089b52c 100644
--- a/mobile/apps/photos/lib/services/wrapped/wrapped_state_service.dart
+++ b/mobile/apps/photos/lib/services/wrapped/wrapped_service.dart
@@ -1,8 +1,12 @@
import "dart:async";
import "package:flutter/foundation.dart";
+import "package:logging/logging.dart";
import "package:photos/service_locator.dart";
import "package:photos/services/wrapped/models.dart";
+import "package:photos/services/wrapped/wrapped_cache_service.dart";
+import "package:photos/services/wrapped/wrapped_engine.dart";
+import "package:synchronized/synchronized.dart";
@immutable
class WrappedEntryState {
@@ -31,9 +35,12 @@ class WrappedEntryState {
int get hashCode => Object.hash(result, resumeIndex, isComplete);
}
-class WrappedStateService {
- WrappedStateService._()
- : _state = ValueNotifier<WrappedEntryState>(
+class WrappedService {
+ WrappedService._()
+ : _logger = Logger("WrappedService"),
+ _cacheService = WrappedCacheService.instance,
+ _computeLock = Lock(),
+ _state = ValueNotifier<WrappedEntryState>(
WrappedEntryState(
result: null,
resumeIndex: 0,
@@ -41,9 +48,16 @@ class WrappedStateService {
),
);
- static final WrappedStateService instance = WrappedStateService._();
+ static final WrappedService instance = WrappedService._();
+ static const Duration _kInitialDelay = Duration(seconds: 5);
+ static const int _kWrappedYear = 2025;
+
+ final Logger _logger;
+ final WrappedCacheService _cacheService;
+ final Lock _computeLock;
final ValueNotifier<WrappedEntryState> _state;
+ bool _initialLoadScheduled = false;
ValueListenable<WrappedEntryState> get stateListenable => _state;
@@ -62,6 +76,85 @@ class WrappedStateService {
DateTime(state.result!.year + 1, 01, 15, 23, 59, 59)
.millisecondsSinceEpoch;
+ void scheduleInitialLoad() {
+ if (_initialLoadScheduled) {
+ return;
+ }
+ _initialLoadScheduled = true;
+ _logger.info("Scheduling Wrapped initial load after $_kInitialDelay");
+ unawaited(Future<void>.delayed(_kInitialDelay, _bootstrap));
+ }
+
+ Future<void> _bootstrap() async {
+ try {
+ final WrappedResult? cached =
+ await _cacheService.read(year: _kWrappedYear);
+ if (cached != null) {
+ _logger.info(
+ "Loaded Wrapped cache for $_kWrappedYear with "
+ "${cached.cards.length} cards",
+ );
+ updateResult(cached);
+ return;
+ }
+ } catch (error, stackTrace) {
+ _logger.severe("Failed to load Wrapped cache", error, stackTrace);
+ }
+
+ if (!isEnabled) {
+ _logger.info(
+ "Wrapped flag disabled; skipping initial compute for $_kWrappedYear",
+ );
+ return;
+ }
+
+ await _runCompute(reason: "initial", bypassFlag: false);
+ }
+
+ Future<void> forceRecompute() async {
+ _logger.warning("Force recompute requested for $_kWrappedYear");
+ await _computeLock.synchronized(() async {
+ await _cacheService.clear(year: _kWrappedYear);
+ updateResult(null);
+ await _computeAndPersist(reason: "forced", bypassFlag: true);
+ });
+ }
+
+ Future<void> _runCompute({
+ required String reason,
+ required bool bypassFlag,
+ }) async {
+ await _computeLock.synchronized(
+ () async => _computeAndPersist(
+ reason: reason,
+ bypassFlag: bypassFlag,
+ ),
+ );
+ }
+
+ Future<void> _computeAndPersist({
+ required String reason,
+ required bool bypassFlag,
+ }) async {
+ if (!bypassFlag && !isEnabled) {
+ _logger.info(
+ "Wrapped flag disabled; skipping compute for $_kWrappedYear ($reason)",
+ );
+ return;
+ }
+
+ _logger.info("Starting Wrapped compute ($reason) for $_kWrappedYear");
+ try {
+ final WrappedResult result =
+ await WrappedEngine.compute(year: _kWrappedYear);
+ await _cacheService.write(result: result);
+ updateResult(result);
+ _logger.info("Wrapped compute completed ($reason)");
+ } catch (error, stackTrace) {
+ _logger.severe("Wrapped compute failed ($reason)", error, stackTrace);
+ }
+ }
+
void updateResult(WrappedResult? result) {
if (result == null || result.cards.isEmpty) {
unawaited(localSettings.setWrapped2025ResumeIndex(0));
diff --git a/mobile/apps/photos/lib/ui/home/header_widget.dart b/mobile/apps/photos/lib/ui/home/header_widget.dart
index e3d8746e6d..6d978403d7 100644
--- a/mobile/apps/photos/lib/ui/home/header_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/header_widget.dart
@@ -1,7 +1,7 @@
import 'package:flutter/widgets.dart';
import 'package:logging/logging.dart';
import 'package:photos/service_locator.dart';
-import "package:photos/services/wrapped/wrapped_state_service.dart";
+import "package:photos/services/wrapped/wrapped_service.dart";
import "package:photos/ui/home/memories/memories_widget.dart";
import 'package:photos/ui/home/status_bar_widget.dart';
import "package:photos/ui/wrapped/wrapped_home_banner.dart";
@@ -22,18 +22,18 @@ class _HeaderWidgetState extends State<HeaderWidget> {
@override
void initState() {
super.initState();
- _wrappedState = wrappedStateService.state;
- wrappedStateService.stateListenable.addListener(_onWrappedStateChanged);
+ _wrappedState = wrappedService.state;
+ wrappedService.stateListenable.addListener(_onWrappedStateChanged);
}
@override
void dispose() {
- wrappedStateService.stateListenable.removeListener(_onWrappedStateChanged);
+ wrappedService.stateListenable.removeListener(_onWrappedStateChanged);
super.dispose();
}
void _onWrappedStateChanged() {
- final WrappedEntryState next = wrappedStateService.state;
+ final WrappedEntryState next = wrappedService.state;
if (!mounted) {
return;
}
@@ -48,7 +48,7 @@ class _HeaderWidgetState extends State<HeaderWidget> {
@override
Widget build(BuildContext context) {
_logger.info("Building header widget");
- final bool showWrappedBanner = wrappedStateService.shouldShowHomeBanner;
+ final bool showWrappedBanner = wrappedService.shouldShowHomeBanner;
final List<Widget> children = <Widget>[
const StatusBarWidget(),
const MemoriesWidget(),
diff --git a/mobile/apps/photos/lib/ui/settings/debug/ml_debug_section_widget.dart b/mobile/apps/photos/lib/ui/settings/debug/ml_debug_section_widget.dart
index 1d8f45dea6..556529ce79 100644
--- a/mobile/apps/photos/lib/ui/settings/debug/ml_debug_section_widget.dart
+++ b/mobile/apps/photos/lib/ui/settings/debug/ml_debug_section_widget.dart
@@ -104,6 +104,24 @@ class _MLDebugSectionWidgetState extends State<MLDebugSectionWidget> {
},
),
sectionOptionSpacing,
+ MenuItemWidget(
+ captionedTextWidget: const CaptionedTextWidget(
+ title: "Recompute Wrapped 2025",
+ ),
+ pressedColor: getEnteColorScheme(context).fillFaint,
+ trailingIcon: Icons.chevron_right_outlined,
+ trailingIconIsMuted: true,
+ onTap: () async {
+ try {
+ await wrappedService.forceRecompute();
+ showShortToast(context, "Wrapped 2025 recomputed");
+ } catch (e, s) {
+ logger.severe('Wrapped recompute failed ', e, s);
+ await showGenericErrorDialog(context: context, error: e);
+ }
+ },
+ ),
+ sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: const CaptionedTextWidget(
title: "Show pending notifications",
diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
index f4acbcfa42..f80fedbbbd 100644
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
@@ -10,7 +10,7 @@ import "package:photos/models/search/index_of_indexed_stack.dart";
import "package:photos/models/search/search_result.dart";
import "package:photos/models/search/search_types.dart";
import "package:photos/service_locator.dart";
-import "package:photos/services/wrapped/wrapped_state_service.dart";
+import "package:photos/services/wrapped/wrapped_service.dart";
import "package:photos/states/all_sections_examples_state.dart";
import "package:photos/ui/common/loading_widget.dart";
import "package:photos/ui/viewer/search/result/no_result_widget.dart";
@@ -86,14 +86,14 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
@override
void initState() {
super.initState();
- _wrappedState = wrappedStateService.state;
- _showWrappedDiscovery = wrappedStateService.shouldShowDiscoveryEntry;
- wrappedStateService.stateListenable.addListener(_onWrappedStateChanged);
+ _wrappedState = wrappedService.state;
+ _showWrappedDiscovery = wrappedService.shouldShowDiscoveryEntry;
+ wrappedService.stateListenable.addListener(_onWrappedStateChanged);
}
@override
void dispose() {
- wrappedStateService.stateListenable.removeListener(_onWrappedStateChanged);
+ wrappedService.stateListenable.removeListener(_onWrappedStateChanged);
super.dispose();
}
@@ -101,9 +101,8 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
if (!mounted) {
return;
}
- final WrappedEntryState nextState = wrappedStateService.state;
- final bool nextShowDiscovery =
- wrappedStateService.shouldShowDiscoveryEntry;
+ final WrappedEntryState nextState = wrappedService.state;
+ final bool nextShowDiscovery = wrappedService.shouldShowDiscoveryEntry;
if (_wrappedState == nextState &&
_showWrappedDiscovery == nextShowDiscovery) {
return;
@@ -113,6 +112,7 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
_showWrappedDiscovery = nextShowDiscovery;
});
}
+
@override
Widget build(BuildContext context) {
final searchTypes = SectionType.values.toList(growable: true);
diff --git a/mobile/apps/photos/lib/ui/wrapped/wrapped_discovery_section.dart b/mobile/apps/photos/lib/ui/wrapped/wrapped_discovery_section.dart
index 9858db9567..cdf458dba6 100644
--- a/mobile/apps/photos/lib/ui/wrapped/wrapped_discovery_section.dart
+++ b/mobile/apps/photos/lib/ui/wrapped/wrapped_discovery_section.dart
@@ -1,6 +1,6 @@
import "package:flutter/material.dart";
import "package:photos/service_locator.dart";
-import "package:photos/services/wrapped/wrapped_state_service.dart";
+import "package:photos/services/wrapped/wrapped_service.dart";
import "package:photos/theme/ente_theme.dart";
class WrappedDiscoverySection extends StatelessWidget {
@@ -16,8 +16,8 @@ class WrappedDiscoverySection extends StatelessWidget {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final bool hasProgress =
- state.resumeIndex > 0 && state.resumeIndex < (state.result?.cards.length ?? 0);
+ final bool hasProgress = state.resumeIndex > 0 &&
+ state.resumeIndex < (state.result?.cards.length ?? 0);
final String subtitle = state.isComplete
? "Replay the full story."
: hasProgress
@@ -87,8 +87,8 @@ class WrappedDiscoverySection extends StatelessWidget {
}
void _handleTap(BuildContext context) {
- if (!wrappedStateService.shouldShowDiscoveryEntry &&
- !wrappedStateService.shouldShowHomeBanner) {
+ if (!wrappedService.shouldShowDiscoveryEntry &&
+ !wrappedService.shouldShowHomeBanner) {
return;
}
diff --git a/mobile/apps/photos/lib/ui/wrapped/wrapped_home_banner.dart b/mobile/apps/photos/lib/ui/wrapped/wrapped_home_banner.dart
index 8ed1167ff7..c878d6f9fc 100644
--- a/mobile/apps/photos/lib/ui/wrapped/wrapped_home_banner.dart
+++ b/mobile/apps/photos/lib/ui/wrapped/wrapped_home_banner.dart
@@ -1,6 +1,6 @@
import "package:flutter/material.dart";
import "package:photos/service_locator.dart";
-import "package:photos/services/wrapped/wrapped_state_service.dart";
+import "package:photos/services/wrapped/wrapped_service.dart";
import "package:photos/theme/ente_theme.dart";
class WrappedHomeBanner extends StatelessWidget {
@@ -15,8 +15,8 @@ class WrappedHomeBanner extends StatelessWidget {
Widget build(BuildContext context) {
final enteColorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final bool hasProgress =
- state.resumeIndex > 0 && state.resumeIndex < (state.result?.cards.length ?? 0);
+ final bool hasProgress = state.resumeIndex > 0 &&
+ state.resumeIndex < (state.result?.cards.length ?? 0);
final String title;
final String subtitle;
@@ -32,8 +32,9 @@ class WrappedHomeBanner extends StatelessWidget {
}
final int cardCount = state.result?.cards.length ?? 0;
- final String detail =
- cardCount > 0 ? "$cardCount card${cardCount == 1 ? '' : 's'}" : "Preview";
+ final String detail = cardCount > 0
+ ? "$cardCount card${cardCount == 1 ? '' : 's'}"
+ : "Preview";
return Padding(
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
@@ -93,8 +94,8 @@ class WrappedHomeBanner extends StatelessWidget {
}
void _handleTap(BuildContext context) {
- if (!wrappedStateService.shouldShowHomeBanner &&
- !wrappedStateService.shouldShowDiscoveryEntry) {
+ if (!wrappedService.shouldShowHomeBanner &&
+ !wrappedService.shouldShowDiscoveryEntry) {
return;
}
ScaffoldMessenger.of(context).showSnackBar(