Hope you can help me, i'm doing an app where i get data the data from another url post of a person like this json body:
{
"orderId":null,
"orderNumber":null,
"orderCode":"VE",
"branchCode":"1214001",
"companyNumber":null,
"currency":"MXN",
"exchangeRate":0.0,
"creationDate":"2023-03-21T21:42:52.915+00:00",
"requestDate":"2023-03-21T21:42:52.915+00:00",
"validityDate":"2023-03-21T21:42:52.915+00:00",
"client":{
"id":1,
"noClient":1,
"taxpayer":"M",
"customerType":"",
"rfc":"XAXX010101010",
"name":"GENERIC",
"fatherSurname":"GENERIC",
"motherSurname":"GENERIC",
"businessName":"CLIENTE UNIVERSAL",
"contact":".",
"phone":"0000000000",
"cell":"0000000000",
"howToContact":"",
"workType":"",
"iva":"16",
"taxRegime":"RPN",
"mail":null,
"nnn001":" - ",
"direction":null,
"shippingAddress":null,
"enabled":false,
"shippingAddressList":null,
"mailList":null
},
"clientTax":16.0,
"clientReference":"",
"userNumber":null,
"idUser":null,
"employeeEmail":"DANIEL@EXAMPLE.COM.MX",
"subTotal":2038.78,
"ivaTotal":326.2,
"orderTotal":2364.98,
"pendingPayment":2364.98,
"discountTotal":0.0,
"addresses":[
{
"id":null,
"street":"MEX",
"colony":"COLONIA",
"state":"NUEVO LEON NLE",
"stateCode":"019",
"delegation":"SALINAS VICTORIA ",
"delegationCode":"019045",
"interiorNumber":"00",
"outdoorNumber":"00",
"cp":"65536",
"city":"MEXICO",
"addressType":"Fiscal",
"flat":"PLANO 019 CIUDAD DE MEXICO",
"flatCode":"019",
"coordinate":"1D",
"coordinateCode":"1D"
},
{
"id":null,
"street":"CALLE",
"colony":"COLONIA",
"state":"NUEVO LEON NLE",
"stateCode":"019",
"delegation":"SALINAS VICTORIA ",
"delegationCode":"019045",
"interiorNumber":"00",
"outdoorNumber":"00",
"cp":"65536",
"city":"MEXICO",
"addressType":"Envío",
"flat":"PLANO 019 CIUDAD DE MEXICO",
"flatCode":"019",
"coordinate":"1E",
"coordinateCode":"1E"
}
]
}
then i need to use the only the address body info to send it to another url, but when i do it, it shows me this error
and i know its the way i call it because i have try other things but nothing works.
I have try like this:
{
"id": dataClient['direction']['id'],
"street": "${dataClient['direction']['street']}",
"colony": "${dataClient['direction']['colony']}",
"state": "${estadoCliente}",
"stateCode": "${dataClient['direction']['stateCode']}",
"delegation": "${mudegCliente}",
"delegationCode": "${dataClient['direction']['delegationCode']}",
"interiorNumber": "${dataClient['direction']['noInterior']}",
"outdoorNumber": "${dataClient['direction']['noOutdoor']}",
"cp": "${dataClient['direction']['cp']}",
"city": "${dataClient['direction']['city']}",
"addressType": "Fiscal",
"flat": "${fatCliente}",
"flatCode": "${dataClient['direction']['flatCode']}",
"coordinate": "${coordCliente}",
"coordinateCode": "${dataClient['direction']['coordinatesCode']}"
},
{
"id": dataClient['shippingAddressList'][0]['id'],
"street": "${dataClient['shippingAddressList'][0]['street']}",
"colony": "${dataClient['shippingAddressList'][0]['colony']}",
"state": "${estadoClienteSend}",
"stateCode": "${dataClient['shippingAddressList'][0]['stateCode']}",
"delegation": "${mudegClienteSend}",
"delegationCode":
"${dataClient['shippingAddressList'][0]['delegationCode']}",
"interiorNumber":
"${dataClient['shippingAddressList'][0]['noInterior']}",
"outdoorNumber":
"${dataClient['shippingAddressList'][0]['noOutdoor']}",
"cp": "${dataClient['shippingAddressList'][0]['cp']}",
"city": "${dataClient['shippingAddressList'][0]['city']}",
"addressType": "Envío",
"flat": "${fatClienteSend}",
"flatCode": "${dataClient['shippingAddressList'][0]['flatCode']}",
"coordinate": "${coordClienteSend}",
"coordinateCode":
"${dataClient['shippingAddressList'][0]['coordinatesCode']}"
}
and also tried putting the information on a list dynamic but also the same:
List adresses;
adresses =
jsonDecode(utf8.decode(response.bodyBytes))['data']['addresses'];
Only when Static Info on the data to send it it´s how it works well. Hope you guys canl help me. Thanks
This error appears when you pass a String where Flutter is expecting a type int. e.g. If Flutter is expecting List[0] and you pass List['value'].
Try doing the same operation with smaller data, with fewer lines. This will allow you to pinpoint where you are going wrong.
Cheers!