second commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user