0

It used to work and the image of the coin was displayed, but for several days this error is displayed instead of the image of the coins. error

enter image description here

 FutureBuilder(
                                                    future:
                                                        getCoinDataDogeCoin(),
                                                    builder: (context,
                                                        AsyncSnapshot<
                                                                CoinGeckoResult<
                                                                    prefix
                                                                        .Coin?>>
                                                            snapshot) {
                                                      return (snapshot
                                                              .hasData)
                                                          ? Center(
                                                              child: Image
                                                                  .network(
                                                                      "${snapshot.data!.data!.image!.small}"),
                                                            )
                                                          : CircularProgressIndicator();
                                                    }),

enter image description here

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56
mary
  • 37
  • 7

1 Answers1

0

As error , it is getting null data and you are using !. Try checking if the value is null or not

if(snapshot.data?.data?.image?.small !=null) Image(....

Here we are accepting null with ? and using ! after checking not null.

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56