Ayz
Ayz

Reputation: 309

how to use debugPrint for image.network?

I want to see the link of the image in the terminal using debugPrint. kindly help me. This is my code:

           FutureBuilder<Iterable<SubCategories>>(
                builder: (context, snapshot) {
                    return ListView.builder(
                      itemBuilder: (context, index) =>
                          Image.network(
                            snapshot.data!.elementAt(index).logo,
                          ),
                    );
                }),

Upvotes: 0

Views: 75

Answers (2)

Joseph Yaduvanshi
Joseph Yaduvanshi

Reputation: 11

debugPrint only takes String as argument. you can do something like this. debugPrint('${snapshot.data!.elementAt(index).logo}');

Upvotes: 1

Aamil Silawat
Aamil Silawat

Reputation: 8239

Try out this:

**Note:** import log as **dart.developer** (import 'dart:developer';)





     FutureBuilder<Iterable<SubCategories>>(
                    builder: (context, snapshot) {                  
                        return ListView.builder(
                          itemBuilder: (context, index) {
                        log("Network image--->${snapshot.data!.elementAt(index).logo}");
                            return Image.network(
                                snapshot.data!.elementAt(index).logo,
                              ),
                          }
                        );
                    }),

Upvotes: 1

Related Questions