Problem
I’m Calling An API to update my data and I got this error, the Error Says,
E/flutter (32582): type 'int' is not a subtype of type 'String' in type cast
Solution
Step 1: use "content-type": "application/json"
in header
Step 2: encode your body like jsonEncode( {"param1": 10, "param2":20,"param3": "abc","param4": true})
Example Code Like
headers: {
"content-type": "application/json",
},
body:jsonEncode( {
"qualificationId": 10,
"year":2001,
"instituteName": "example",
"isActive": true
})
That’s it.
Thanks for Reading.
Keep Coding.
Latest posts by Sushant K (see all)
- [SOLVED] Flutter : Waiting for another flutter command to release the startup lock. - July 2, 2021
- How to Change Passport Token length in laravel. - June 12, 2021
- Flutter : How to dismiss an AlertDialog on Button? - June 7, 2021