second commit
This commit is contained in:
63
lib/Data/Provider/Tenantlocation/Getlocationprovider.dart
Normal file
63
lib/Data/Provider/Tenantlocation/Getlocationprovider.dart
Normal file
@@ -0,0 +1,63 @@
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
import '../../../Model/Response/Tenantlocation/Getlocationbyidresponse.dart';
|
||||
import '../../../Model/Response/Tenantlocation/Locationbyid/Locationidresponse.dart';
|
||||
|
||||
|
||||
class GetLocationsProvider{
|
||||
|
||||
Future<GetLocationByTenantId?> getTenantLocationById(String urldata) async {
|
||||
GetLocationByTenantId? getLocationById;
|
||||
try {
|
||||
|
||||
final url = Uri.parse('$urldata',);
|
||||
|
||||
final response = await http.get(url,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
// 'Authorization': '$token',
|
||||
},
|
||||
);
|
||||
print('GetLocation!!!!!!!!${response.body}');
|
||||
print('GetLocationproviderurldata!!!!!!!!${urldata.toString()}');
|
||||
Map<String, dynamic> parsedJson = json.decode(response.body.toString());
|
||||
|
||||
getLocationById = GetLocationByTenantId.fromJson(parsedJson);
|
||||
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
print("error");
|
||||
}
|
||||
return getLocationById;
|
||||
}
|
||||
|
||||
Future<GetLocationByLocaionId?> getLocationById(String urldata) async {
|
||||
GetLocationByLocaionId? getLocationsById;
|
||||
try {
|
||||
|
||||
final url = Uri.parse('$urldata',);
|
||||
|
||||
final response = await http.get(url,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
// 'Authorization': '$token',
|
||||
},
|
||||
);
|
||||
print('getLocationById!!!!!!!!${response.body}');
|
||||
print('getLocationByIdproviderurldata!!!!!!!!${urldata.toString()}');
|
||||
Map<String, dynamic> parsedJson = json.decode(response.body.toString());
|
||||
|
||||
getLocationsById = GetLocationByLocaionId.fromJson(parsedJson);
|
||||
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
print("error");
|
||||
}
|
||||
return getLocationsById;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user