Files
2026-05-27 10:35:09 +05:30

37 lines
936 B
Dart

import 'dart:convert';
import 'package:http/http.dart' as http;
import '../../../../Model/Response/Tenantlocation/Getlocationbyidresponse.dart';
class GetLocationsProvider{
Future<GetLocationByTenantId?> getLocationById(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;
}
}