title: How to solve "Expected a value of type 'int', but got one of type 'String'" in Flutter
body: <p>I have a local JSON file which looks like this:</p>
  <pre><code>[
      {
          &quot;1&quot;: [
              {
                  &quot;mode&quot;: &quot;text&quot;,
                  &quot;value&quot;: &quot;text exapple1&quot;
              },
              {
                  &quot;mode&quot;: &quot;latex&quot;,
                  &quot;value&quot;: &quot;\frac00&quot;
              },
              {
                  &quot;mode&quot;: &quot;text&quot;,
                  &quot;value&quot;: &quot;text exapple2&quot;
              },
              {
                  &quot;mode&quot;: &quot;latex&quot;,
                  &quot;value&quot;: &quot;\frac00&quot;
              },
              {
                  &quot;mode&quot;: &quot;text&quot;,
                  &quot;value&quot;: &quot;text exapple3&quot;
              }
          ]
      },
      {
          &quot;2&quot;: [
              {
                  &quot;mode&quot;: &quot;text&quot;,
                  &quot;value&quot;: &quot;text exapple4&quot;
              }
          ]
      }
  ]
  </code></pre>
  <p>and I am trying to parse it using FutureBuilder in my code:</p>
  <pre><code>return FutureBuilder(
      future:
          DefaultAssetBundle.of(context).loadString(&quot;assets/paragraph.json&quot;),
      builder: (context, snapshot) {
        var mydata = json.decode(snapshot.data.toString());
        if (mydata != null) {
          return SizeTransition(
              axis: Axis.vertical,
              sizeFactor: animation,
              child: Center(child: Text(mydata[&quot;1&quot;][0].toString()))
              );
        } else {
          return SizeTransition(
              axis: Axis.vertical,
              sizeFactor: animation,
              child: Center(child: CircularProgressIndicator())
              );
        }
      });
  </code></pre>
  <p>Here is the error message I get:</p>
  <blockquote>
  <p>══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY
  ╞═══════════════════════════════════════════════════════════
  The following TypeErrorImpl was thrown building
  FutureBuilder(dirty, state:
  _FutureBuilderState#4fb8d):
  Expected a value of type 'int', but got one of type 'String'</p>
  </blockquote>
  <p>and if I do it like:</p>
  <pre><code>mydata[1][1]
  </code></pre>
  <p>it gives me a null output!</p>
  <p>What is wrong with this code and how to fix it?</p>