import 'package:discover_module/contacts_module/service.dart/k2_service/Apicall_k2.dart'; import 'package:discover_module/contacts_module/storage_hive/loc_data/crud_loc.dart'; import 'package:flutter/cupertino.dart'; class LocationKolProvider extends ChangeNotifier { final apicall = CallK2api(); List loclist = []; List get locationlist => loclist; locationinfo(text) async { print("Location_Text"); final publication_result = await apicall.getlocationsdata(text); loclist = publication_result; notifyListeners(); return publication_result; } bool get hasData => loclist.isNotEmpty; // Future fetchLocations(int text, int? offline, bool? offlineMode) async { // // if (_isLoading) return; // // _isLoading = true; // // notifyListeners(); // // Your API logic here // print("FEcthing_var $text, $offline, $offlineMode"); // if (offline == 1) { // //_locationList = await retrieveidlocations(text); // } else { // print("FEcthing_data"); // final publication_result = await apicall.getlocationsdata(text); // _locationList = publication_result; // // Fetch data when online // // Example: _locationList = await fetchFromAPI(text); // } // _isLoading = false; // notifyListeners(); // } storeLoc(row) async { final publicationResult = await apicall.getlocationsdata(row); print("Getting_data_isss: ${publicationResult}"); // await addLoc(publicationResult); await k2addLoc(publicationResult); } }