{"id":6393,"date":"2021-05-27T06:36:53","date_gmt":"2021-05-27T06:36:53","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=6393"},"modified":"2021-05-27T06:45:15","modified_gmt":"2021-05-27T06:45:15","slug":"flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/","title":{"rendered":"[SOLVED] Flutter : Unhandled Exception: type &#8216;int&#8217; is not a subtype of type &#8216;String&#8217; in type cast"},"content":{"rendered":"\n<h2 class=\"has-text-align-center wp-block-heading\"><span class=\"has-inline-color has-vivid-red-color\">Problem<\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;m Calling An API to update my data and I got this error, the Error Says,<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>E\/flutter (32582): type 'int' is not a subtype of type 'String' in type cast\n<\/code><\/pre>\n\n\n\n<h2 class=\"has-text-align-center wp-block-heading\"><span class=\"has-inline-color has-vivid-red-color\">Solution<\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1:<\/strong> use&nbsp;<code>\"content-type\": \"application\/json\"<\/code>&nbsp;in header<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 2:<\/strong> encode your body like&nbsp;<code>jsonEncode( {\"param1\": 10, \"param2\":20,\"param3\": \"abc\",\"param4\": true})<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example Code Like<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>headers: {\n      \"content-type\": \"application\/json\",\n    },\n    body:jsonEncode( {\n      \"qualificationId\": 10,\n      \"year\":2001,\n      \"instituteName\": \"example\",\n      \"isActive\": true\n    })<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s it. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks for Reading.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Keep Coding. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"300\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/05\/Keep_coding.gif\" alt=\"\" class=\"wp-image-6350\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Problem I&#8217;m Calling An API to update my data and I got this error, the Error Says, Solution Step 1: [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6393","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[SOLVED] Flutter : Unhandled Exception: type &#039;int&#039; is not a subtype of type &#039;String&#039; in type cast - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[SOLVED] Flutter : Unhandled Exception: type &#039;int&#039; is not a subtype of type &#039;String&#039; in type cast - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"Problem I&#8217;m Calling An API to update my data and I got this error, the Error Says, Solution Step 1: [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-27T06:36:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-27T06:45:15+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/05\/Keep_coding.gif\" \/>\n<meta name=\"author\" content=\"Sushant K\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sushant K\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\\\/\"},\"author\":{\"name\":\"Sushant K\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/7cb2b03b970bcfe605e1be29d2b6791c\"},\"headline\":\"[SOLVED] Flutter : Unhandled Exception: type &#8216;int&#8217; is not a subtype of type &#8216;String&#8217; in type cast\",\"datePublished\":\"2021-05-27T06:36:53+00:00\",\"dateModified\":\"2021-05-27T06:45:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\\\/\"},\"wordCount\":58,\"commentCount\":1,\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Keep_coding.gif\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\\\/\",\"name\":\"[SOLVED] Flutter : Unhandled Exception: type 'int' is not a subtype of type 'String' in type cast - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Keep_coding.gif\",\"datePublished\":\"2021-05-27T06:36:53+00:00\",\"dateModified\":\"2021-05-27T06:45:15+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/7cb2b03b970bcfe605e1be29d2b6791c\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\\\/#primaryimage\",\"url\":\"http:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Keep_coding.gif\",\"contentUrl\":\"http:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Keep_coding.gif\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[SOLVED] Flutter : Unhandled Exception: type &#8216;int&#8217; is not a subtype of type &#8216;String&#8217; in type cast\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/7cb2b03b970bcfe605e1be29d2b6791c\",\"name\":\"Sushant K\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/092cd9bf0832fe9aa2450955f90b56545e8f7b54e08173f584c5130ad01df057?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/092cd9bf0832fe9aa2450955f90b56545e8f7b54e08173f584c5130ad01df057?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/092cd9bf0832fe9aa2450955f90b56545e8f7b54e08173f584c5130ad01df057?s=96&d=mm&r=g\",\"caption\":\"Sushant K\"},\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/sushant\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[SOLVED] Flutter : Unhandled Exception: type 'int' is not a subtype of type 'String' in type cast - scmGalaxy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/","og_locale":"en_US","og_type":"article","og_title":"[SOLVED] Flutter : Unhandled Exception: type 'int' is not a subtype of type 'String' in type cast - scmGalaxy","og_description":"Problem I&#8217;m Calling An API to update my data and I got this error, the Error Says, Solution Step 1: [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/","og_site_name":"scmGalaxy","article_published_time":"2021-05-27T06:36:53+00:00","article_modified_time":"2021-05-27T06:45:15+00:00","og_image":[{"url":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/05\/Keep_coding.gif","type":"","width":"","height":""}],"author":"Sushant K","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Sushant K"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/"},"author":{"name":"Sushant K","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/7cb2b03b970bcfe605e1be29d2b6791c"},"headline":"[SOLVED] Flutter : Unhandled Exception: type &#8216;int&#8217; is not a subtype of type &#8216;String&#8217; in type cast","datePublished":"2021-05-27T06:36:53+00:00","dateModified":"2021-05-27T06:45:15+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/"},"wordCount":58,"commentCount":1,"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/#primaryimage"},"thumbnailUrl":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/05\/Keep_coding.gif","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/","name":"[SOLVED] Flutter : Unhandled Exception: type 'int' is not a subtype of type 'String' in type cast - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/#primaryimage"},"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/#primaryimage"},"thumbnailUrl":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/05\/Keep_coding.gif","datePublished":"2021-05-27T06:36:53+00:00","dateModified":"2021-05-27T06:45:15+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/7cb2b03b970bcfe605e1be29d2b6791c"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/#primaryimage","url":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/05\/Keep_coding.gif","contentUrl":"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/05\/Keep_coding.gif"},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/flutter-unhandled-exception-type-int-is-not-a-subtype-of-type-string-in-type-cast\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"[SOLVED] Flutter : Unhandled Exception: type &#8216;int&#8217; is not a subtype of type &#8216;String&#8217; in type cast"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/7cb2b03b970bcfe605e1be29d2b6791c","name":"Sushant K","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/092cd9bf0832fe9aa2450955f90b56545e8f7b54e08173f584c5130ad01df057?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/092cd9bf0832fe9aa2450955f90b56545e8f7b54e08173f584c5130ad01df057?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/092cd9bf0832fe9aa2450955f90b56545e8f7b54e08173f584c5130ad01df057?s=96&d=mm&r=g","caption":"Sushant K"},"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/sushant\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/6393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=6393"}],"version-history":[{"count":4,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/6393\/revisions"}],"predecessor-version":[{"id":6399,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/6393\/revisions\/6399"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=6393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=6393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=6393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}