To avoid jank, you need to perform expensive computations
like this in the background.
On Android, this means scheduling work on a different thread.
In Flutter, you can use a separate Isolate.
This recipe uses the following steps:

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.

1. Add the http package

First, add the http package to your project.
The http package makes it easier to perform network
requests, such as fetching data from a JSON endpoint.

dependencies

http

<latest_version>

2. Make a network request

This example covers how to fetch a large JSON document
that contains a list of 5000 photo objects from the
JSONPlaceholder REST API,
using the http.get() method.