Hive for local storage

Custom Code

The data is being saved, but when I reload the app, the data is empty

initializeHive:

import 'package:hive/hive.dart';

import 'package:hive_flutter/hive_flutter.dart';

Future<void> initializeHive() async {

await Hive.initFlutter(); // Initialize Hive

}

saveFirebaseDataToHive:

import 'package:hive/hive.dart';

Future<void> saveFirebaseDataToHive(List<String> data) async {

var box = await Hive.openBox('firebaseDataBox'); // Open or create box

await box.put('firebaseDocuments',

data); // Save the List<String> under 'firebaseDocuments' key

}

loadDataFromHive:

import 'package:hive/hive.dart';

Future<List<String>> loadDataFromHive() async {

var box = await Hive.openBox('firebaseDataBox');

List<String>? storedList =

box.get('firebaseDocuments'); // Retrieve the stored list

return storedList ?? []; // Return empty list if no data found

}

What have you tried so far?

I've tried fixing it through ChatGPT, but none of the methods worked

Did you check FlutterFlow's Documentation for this topic?
No
2