Local Storage
-
Dependencies:
- Ensure the
shared_preferences
package is added to yourpubspec.yaml
.
- Ensure the
-
Code Integration:
-
Local storage is initialized in
lib/core/storage/local_storage.dart
. -
Initialize local storage in the main function:
void main() async { WidgetsFlutterBinding.ensureInitialized(); await LocalStorage.initialize(); runApp(MyApp()); }
-
Use the
LocalStorage
class to get/set variables:// Set a value await LocalStorage.setString('key', 'value'); // Get a value String value = LocalStorage.getString('key');
-