Files
daily_mobileapp_merchant/lib/Controller/More/Locations/Locationcontroller.dart
2026-05-27 10:35:09 +05:30

45 lines
1.2 KiB
Dart

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;
List<TenantLocationDetails>locations = [];
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();
}
}