I developed demo web app with Flutter and upload it on my server and I used Hive database to store some data on web app.
Recently I found that when I open web app and store some data on it, if I use different browser again I can't see the previously stored data, it seems that Hive on Flutter web will store data somewhere on client side cache.
I have 3 questions now:
Where is the location of hive database and how can I access it manually?
How can I fix this problem and store data on my server with Flutter web that every user could see the same data?
Should I use Dart for server side to achieve this goal? If yes, where can I start and find good documents?
Here is my code to save and load data:
void _initHiveDB() async {
if (_isDBInited) {
return;
}
if(!kIsWeb){
final documentsDirectory = await Path_Provider.getApplicationDocumentsDirectory();
Hive.init(documentsDirectory.path);
}
Hive.registerAdapter(ComplaintModelAdapter(), 0);
_isDBInited = true;
}
Future<bool> saveNewComplaint(ComplaintModel complaintModel)async{
try{
if(_complaintBox==null||!_complaintBox.isOpen){
_complaintBox = await Hive.openBox('Complaints');
}
else{
_complaintBox = Hive.box('Complaints');
}
_complaintBox.add(complaintModel);
return true;
}
catch(exc){
return false;
}
}
Future<List<ComplaintModel>> loadAllComplaints() async {
try{
if(_complaintBox==null||!_complaintBox.isOpen){
_complaintBox = await Hive.openBox('Complaints');
}
else{
_complaintBox = Hive.box('Complaints');
}
//Box<ComplaintModel> complaintBox = await Hive.openBox('Complaints');
//Box<ComplaintModel> complaintBox = await Hive.box('Complaints');
List<ComplaintModel> complaints = _complaintBox.values.toList();
return complaints;
}
catch(exc){
return null;
}}

