title: How to decode large json array in flutter
body: <p>I have a rather large json file that I have downloaded using my flutter app from a web api that's around 200MB using</p>
  <pre><code>final response = Dio().get(uri, options: Options(responseType: ResponseType.plain));
  </code></pre>
  <p>(Using default Dio options also uses json decoding, resulting in an out of memory exception.
  This is not directly part of my problem but maybe it helps)</p>
  <p>Now the problem starts after obtaining the json string.
  When I use jsonDecode on the response body I run out of memory. (maybe the same function Dio uses?)</p>
  <p><code>final data = jsonDecode(response.body);</code> this runs out of memory</p>
  <p>The json object itself is an array with a lot of items with a format like this:</p>
  <pre><code>[
    {&quot;data&quot;: {independent data1}},
    {&quot;data&quot;: {independent data2}},
    ...
  ]
  </code></pre>
  <p>and i would be fine just decoding one item at a time instead of everything at once to reduce memory usage. Is there another way to do process all the items in this array? Something like</p>
  <pre><code>jsonArrayDecode(response.body, onItemDecode: (item) { /*do stuff with item */ });
  </code></pre>
  <p>Or do I have to write my own json reader that can sequentially decode it?</p>