import 'dart:convert'; import 'package:http/http.dart'; import '../../../Model/Request/Authentication/Createuser/Createdeliveryaddress/Createdeliveryaddressrequest.dart'; import '../../../Model/Request/Createcustomer/Createcustomerrequest.dart'; import '../../../Model/Response/Createcustomer/Createcustomerresponse.dart'; import '../../../Model/Response/Createcustomer/Createdeliveryaddress/Createdeliveryaddressresponsel.dart'; class CreateCustomerProvider{ Future createCustomer(CreateCustomers data,String urldata,) async { CreateCustomerResponse? createCustomers; 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('createCustomercontactno${data.firstname}'); print('createCustomercontactno${data.contactno}'); print('createCustomerapplocationid${data.applocationid}'); print('createCustomercontactno${data}'); print('responsebodyincreatecustomer${response.body}'); print('urldatacreatecustomer ${url}'); Map parsedJson = json.decode(response.body.toString()); createCustomers = CreateCustomerResponse.fromJson(parsedJson); } catch (e) { print(e.toString()); print("error"); } return createCustomers; } Future createDeliveryAddress(CreateDeliveryAddress data,String urldata,) async { CreateDeliveryAddressResponse? createDeliveryAddress; 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('customeridinproviderdada${data.customerid}'); print('responsebodyincreateDeliveryAddress ${response.body}'); print('urldatacreateDeliveryAddress ${url}'); Map parsedJson = json.decode(response.body.toString()); createDeliveryAddress = CreateDeliveryAddressResponse.fromJson(parsedJson); } catch (e) { print(e.toString()); print("error"); } return createDeliveryAddress; } }