63 lines
1.8 KiB
Dart
63 lines
1.8 KiB
Dart
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;
|
|
}
|
|
|
|
|
|
|
|
} |