import 'package:hive_flutter/hive_flutter.dart'; class HiveFunctions { // String userHiveBox="User Box"; // Box which will use to store the things static final _contactbox = Hive.box("mycontact"); static var box1 = Hive.box('checkvalue'); static final apihcpdata = Hive.box("hcpdata"); static createUser(Map data) { _contactbox.add(data); } static List getAllUsers() { final data = _contactbox.keys.map((key) { final value = _contactbox.get(key); print("Checking_Name : $value"); return { "id": value["id"], "name": value["name"], "org": value["org"], "addr": value["addr"], "phone": value["phone"], "phone_no": value["phone_no"], "email": value["email"], "affiliations_count": value["affiliations_count"], "events_count": value["events_count"], "publications_count": value["publications_count"], "trail_count": value["trail_count"], "summarry": value["summarry"], "license_no": value["license_no"], "p_suffix": value["p_suffix"], "speciality": value["speciality"], "sub_speciality": value["sub_speciality"] }; }).toList(); return data.reversed.toList(); } static List getindexUsers() { final data = _contactbox.keys.map((key) { final value = _contactbox.get(key); print("Checking_Name : $value"); return { "name": value["name"], "org": value["org"], "adrr": value["adrr"], "phone": value["phone"], "Pphone": value["Pphone"], "email": value["email"], "affno": value["affno"], "eveno": value["eveno"], "pubno": value["pubno"], "trailno": value["trailno"] }; }).toList(); return data.reversed.toList(); } static addno(int selectedRowId) { // final box1 = Hive.box("mycontact"); print("SelectedStoredvaluessss: $selectedRowId"); box1.add(selectedRowId); } static getno() { // final box1 = Hive.box("mycontact"); return box1.values; } static storehcpdata(Map data) { apihcpdata.add(data); } static gethcpdata() { return apihcpdata.values; } static Future getindexUser(String text) async { print("Text_issssssS: $text"); // final value = _contactbox.get(int.parse(text)); // print("Checking_Name1111 : $value"); // final data = _contactbox.keys.map((key) { // var contactBox = // await Hive.openBox('contacts'); // Replace 'contacts' with your box name final value = _contactbox.values; print("Checking_Name : $value"); print("Checking_Name : ${value.contains(text)}"); // final dataa = value.get(text); // return { // "name": value["name"], // "org": value["org"], // "adrr": value["adrr"], // "phone": value["phone"], // "Pphone": value["Pphone"], // "email": value["email"], // "affno": value["affno"], // "eveno": value["eveno"], // "pubno": value["pubno"], // "trailno": value["trailno"] // }; // }).toList(); // print("Check_data_is: $data"); return value.toList(); } }