We all know that , In Flutter Dart lang do all of their work on a single request. In most of the cases, this model simplifies coding and is fast development that it does not result in poor app performance or stuttering animations, In this tutorial we are using Json API to fetch images and displaying them to the user.
To do this, we have to perform an expensive computation, such as parsing a very large JSON document. It will takes very less time achieve this in Flutter, After completion of app your users will experience jank. In Flutter, we can use a separate Isolate to avoid this jank.
Steps to follow for Parsing JSON API in the background in flutter App:
- Add the
http
package - Make a network request using the
http
package - Convert the response into a List of Photos
- Move this work to a separate isolate
Add the dependency package to flutter app:
First, adding the http
dependency package to your project. The http
package makes it easier to perform network requests over the internet, such as fetching data from a JSON API. Add the below code to spec.yaml file