second commit
This commit is contained in:
45
lib/Controller/More/Locations/Locationcontroller.dart
Normal file
45
lib/Controller/More/Locations/Locationcontroller.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user