// import 'package:discover_module/storage_hive/speaker_data/speaker_model_hive.dart'; import 'package:discover_module/contacts_module/storage_hive/speaker_data/speaker_model_hive.dart'; import 'package:hive_flutter/hive_flutter.dart'; addSpeaker(List nihlist) async { var box = await Hive.openBox('speahive'); List pros = nihlist.map((json) { return Spe( id: json.id, programtopic: json.programtopic, speakername: json.speakername.toString() ?? '', role: json.role ?? '', evaluatorname: json.evaluatorname.toString() ?? '', programdate: json.programdate.toString() ?? '', createdAt: json.createdAt.toString() ?? '', updatedAt: json.updatedAt.toString() ?? '', ); }).toList(); print("Eduactionnsss ${pros}"); for (var pro in pros) { print("Storing_Eduactionnsss: ${pro.evaluatorname}"); //await box.put(pro.id, pro); // Use `put` with id as key await box.put(await getNextAutoIncrementValue(), pro); } } // await box.put(await getNextAutoIncrementValue(), doctor); // } Future getNextAutoIncrementValue() async { var counterBox = await Hive.openBox('counterBox'); if (!counterBox.containsKey('counter')) { counterBox.put('counter', 0); } int? counter = counterBox.get('counter'); counterBox.put('counter', counter! + 1); await counterBox.close(); return counter; } retrieveidspeaker(int id) async { var box = await Hive.openBox('speahive'); print('Retrive Doctor}'); var pros = box.get(id); print('Retrive Doctor Procedure123 ${pros}'); List datapro = []; if (pros != null) { datapro.add(pros); // Add to the list if not null } return datapro; }