DiscoverModule/lib/contacts_module/provider_class/k2_provider/kol_locationprovider.dart

53 lines
1.5 KiB
Dart
Raw Normal View History

2024-10-07 12:41:28 +00:00
import 'package:discover_module/contacts_module/service.dart/k2_service/Apicall_k2.dart';
2024-11-22 10:38:43 +00:00
import 'package:discover_module/contacts_module/storage_hive/loc_data/crud_loc.dart';
2024-08-30 12:24:54 +00:00
import 'package:flutter/cupertino.dart';
2024-10-07 12:41:28 +00:00
class LocationKolProvider extends ChangeNotifier {
final apicall = CallK2api();
2024-08-30 12:24:54 +00:00
List loclist = [];
List get locationlist => loclist;
locationinfo(text) async {
print("Location_Text");
final publication_result = await apicall.getlocationsdata(text);
loclist = publication_result;
notifyListeners();
2024-11-22 10:38:43 +00:00
return publication_result;
}
bool get hasData => loclist.isNotEmpty;
// Future<void> 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);
2024-08-30 12:24:54 +00:00
}
}