Home > Back-end >  how to use debugPrint for image.network?
how to use debugPrint for image.network?

Time:08-31

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,
                          ),
                    );
                }),

CodePudding user response:

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,
                              ),
                          }
                        );
                    }),

CodePudding user response:

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

  • Related