File tree Expand file tree Collapse file tree 1 file changed +19
-11
lines changed
Expand file tree Collapse file tree 1 file changed +19
-11
lines changed Original file line number Diff line number Diff line change 1- import 'package:ht_kv_storage_service/ht_kv_storage_service.dart' ;
1+ import 'package:ht_kv_storage_service/src/ ht_kv_storage_service.dart' ;
22
3- /// {@template storage_keys }
4- /// Defines a collection of constant keys used for accessing values
3+ /// {@template storage_key }
4+ /// Defines enum members representing keys used for accessing values
55/// stored within the [HtKVStorageService] .
66///
7- /// This class prevents the use of magic strings for keys, promoting
8- /// type safety and reducing potential runtime errors.
7+ /// This enum prevents the use of magic strings for keys, promoting
8+ /// type safety and reducing potential runtime errors. Use the [stringValue]
9+ /// getter to access the underlying string representation for storage.
910/// {@endtemplate}
10- class StorageKeys {
11- /// Private constructor to prevent instantiation.
12- const StorageKeys ._();
13-
11+ enum StorageKey {
1412 /// Key for storing the email address used during a passwordless sign-in
1513 /// process.
16- static const String pendingSignInEmail = 'pending_signin_email' ;
14+ pendingSignInEmail,
1715
1816 /// Key for storing a boolean flag indicating whether the user has completed
1917 /// the onboarding flow.
20- static const String hasSeenOnboarding = 'has_seen_onboarding' ;
18+ hasSeenOnboarding;
19+
20+ /// Returns the snake_case string representation of the key for storage.
21+ String get stringValue {
22+ switch (this ) {
23+ case StorageKey .pendingSignInEmail:
24+ return 'pending_signin_email' ;
25+ case StorageKey .hasSeenOnboarding:
26+ return 'has_seen_onboarding' ;
27+ }
28+ }
2129}
You can’t perform that action at this time.
0 commit comments