Mobile App
Local Storage

Local Storage

  1. Dependencies:

    • Ensure the shared_preferences package is added to your pubspec.yaml.
  2. 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');