MOTOSHARE 🚗🏍️

Rent Bikes & Cars Directly from Owners

Motoshare connects vehicle owners with people who need bikes and cars on rent. Owners earn from idle vehicles, and renters get flexible ride options.

Visit Motoshare

[SOLVED] Flutter : Unhandled Exception: type ‘int’ is not a subtype of type ‘String’ in type cast

Uncategorized

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.

4 1 vote
Article Rating
Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
sourav
sourav
3 years ago
  1. _CastError (type ‘List<String>’ is not a subtype of type ‘String’ in type cast)
1
0
Would love your thoughts, please comment.x
()
x