Files
daily_mobileapp_merchant/lib/Data/Provider/Location/Addlocation/Addlocationprovider.dart
2026-05-27 10:35:09 +05:30

46 lines
1.5 KiB
Dart

import 'dart:convert';
import 'package:http/http.dart';
import '../../../../Model/Request/Location/Addlocation/Addlocationrequest.dart';
import '../../../../Model/Response/Location/Addlocation/Addlocationresponse.dart';
class AddLocationProvider{
Future<AddLocationResponse?> addLocation(AddLocation data,String urldata,) async {
AddLocationResponse? addLocationResponse;
try {
final url = Uri.parse(urldata);
final response = await post(url,
body: json.encode(data),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
// 'Authorization': '$token',
});
print('addLocationResponseresponsebody ${response.body}');
print('addLocationResponsedatatoJson ${data.toJson()}');
print('addLocationResponseresponseorderdate ${data.tenantid}');
print('addLocationResponseresponsetenantid ${data.locationid}');
print('addLocationResponseresponsemoduleid ${data.moduleid}');
print('addLocationResponseresponsepartnerid ${data.partnerid}');
// print('headerssssssssss ${response.headers}');
print('addLocationResponseurlsssssssssss ${urldata.toString()}');
Map<String, dynamic> parsedJson = json.decode(response.body.toString());
addLocationResponse = AddLocationResponse.fromJson(parsedJson);
print('createOrderinprovider $addLocationResponse');
} catch (e) {
print(e.toString());
print("error");
}
return addLocationResponse;
}
}