copy deck
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user