copy deck

This commit is contained in:
gitea
2026-01-03 06:14:14 +01:00
parent cad489b678
commit 51e88a4aaf
14 changed files with 646 additions and 69 deletions
+3 -10
View File
@@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:practice_engine/practice_engine.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../data/default_deck.dart';
/// Service for managing deck storage and retrieval.
/// Uses persistent storage via shared_preferences.
@@ -29,19 +28,13 @@ class DeckStorage {
await _initFuture;
}
/// Initialize storage with default deck if empty
/// Initialize storage
Future<void> initialize() async {
if (_initialized) return;
await _initSharedPreferences();
// Load existing decks
final deckIds = _prefs!.getStringList(_deckIdsKey) ?? [];
// Add default deck if no decks exist
if (deckIds.isEmpty) {
final defaultDeck = DefaultDeck.deck;
await saveDeck(defaultDeck);
}
// Don't automatically create default deck - let users add it manually
// This allows them to choose whether to include mock data
}
/// Ensure storage is initialized