title: error when trying to decode json and casting it
body: <p>I am trying to decode complex json data and always resulting in error.
  Below are my json data:</p>
  <pre><code>    {
      &quot;status_code&quot;: 200,
      &quot;message&quot;: &quot;Successfully get data user&quot;,
      &quot;data&quot;: {
          &quot;sec_user&quot;: {
              &quot;clientIp&quot;: &quot;1.4.2.54&quot;,
              &quot;officeid&quot;: &quot;N/A&quot;,
          },
          &quot;username&quot;: &quot;uname&quot;,
          &quot;name1&quot;: &quot;&quot;,
          &quot;menus&quot;: [
              {
                  &quot;appl_id&quot;: &quot;MTC&quot;,
                  &quot;menu_caption&quot;: &quot;Master&quot;,
                  &quot;menu_path&quot;: &quot;/master&quot;,
                  &quot;submenus&quot;: [
                      {
                          &quot;menu_caption&quot;: &quot;Machine List&quot;,
                          &quot;note1&quot;: &quot;master&quot;,
                          &quot;sub_menu_id&quot;: &quot;1&quot;,
                          &quot;route_path&quot;: &quot;/machine_list&quot;
                      },
                      {
                          &quot;menu_caption&quot;: &quot;Sparepart Category&quot;,
                          &quot;note1&quot;: &quot;master&quot;,
                          &quot;sub_menu_id&quot;: &quot;1&quot;,
                          &quot;route_path&quot;: &quot;/sparepart_category&quot;
                      }
                  ]
              },
              {
                  &quot;appl_id&quot;: &quot;MTC&quot;,
                  &quot;menu_caption&quot;: &quot;Master&quot;,
                  &quot;menu_path&quot;: &quot;/master&quot;,
                  &quot;submenus&quot;: [
                      {
                          &quot;menu_caption&quot;: &quot;Machine List&quot;,
                          &quot;note1&quot;: &quot;master&quot;,
                          &quot;sub_menu_id&quot;: &quot;1&quot;,
                          &quot;route_path&quot;: &quot;/machine_list&quot;
                      }
                  ]
              },
          ]
      }
  }
  </code></pre>
  <p>and I already create a model class using json to dart (and already retouch it a bit) and use json annotation and build runner. Then I get an error everytime I tried to decode the body of this json</p>
  <pre><code>if (jsonResponse.statusCode == 200) {
    final jsonItems =
        json.decode(jsonResponse.body).cast&lt;Map&lt;String, dynamic&gt;&gt;();
    List&lt;Profile&gt; profile = jsonItems.map&lt;Profile&gt;((json) {
      return MyMenu.fromJson(json);
    }).toList();
    return profile;
  }
  </code></pre>
  <p>I always get this error message (attached on the image bellow):
  <a href="https://i.stack.imgur.com/5sP9t.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5sP9t.png" alt="enter image description here" /></a></p>
  <p>What when wrong with my code ?</p>