import 'package:get/get.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../../../Data/Repository/Location/GetLocation/getlocationrepository.dart'; import '../../../Model/Response/Tenantlocation/Getlocationbyidresponse.dart'; class LocationController extends GetxController{ int? tenantId; int? moduleId; Listlocations = []; bool shimmer = true; GetLocationsRepository getLocationsRepository= GetLocationsRepository(); getLocation()async{ SharedPreferences prefs = await SharedPreferences.getInstance(); tenantId = prefs.getInt('tenantId')??0; moduleId = prefs.getInt('moduleId')??0; GetLocationByTenantId? result = await getLocationsRepository.getLocationById(); getLocationByIdResult(result!); } getLocationByIdResult(GetLocationByTenantId data) async { print('location result'); if (data.code == 200) { SharedPreferences prefs = await SharedPreferences.getInstance(); locations = data.details!; shimmer = false; update(); print('usernamesss ${prefs.getString('userName')??''}'); print('gettenantIdinset${prefs.getInt('tenantId')!}'); } } @override void onInit() { // TODO: implement onInit super.onInit(); } }