Search code examples
flutterimagedartlistview

How to get images from folder to show in listview builder?


I want to retrieve images from a folder. Problem_image shows in listview builder which name of image i stored in database i write code and try to run but found image not showing only blue color circle showing which i don't want like i want image to show how can i fix it? enter image description here

Code
Expanded(
              child: StreamBuilder(
                stream: _streamController.stream,
                 builder: (context, snapshots) {
                  if (snapshots.hasData) {
                     return ListView.builder(
                        itemCount: problemlist.length,
                        itemBuilder: ((context, index) {
                          problemModel problem = problemlist[index];
                          return Card(
                            margin: EdgeInsets.all(10),
                            child: ListTile(
                              leading: CircleAvatar(
                                backgroundImage: NetworkImage(
                                 'http://192.168.1.148/skc/Problem_image?problem.image',
                                ),
                              ),
                              title: Text(
                                 problem.name_surname,
                                style: TextStyle(
                                    fontWeight: FontWeight.bold, fontSize: 19),
                              ),
                              subtitle: Text(
                                problem.status,
                                style: TextStyle(
                                    fontWeight: FontWeight.bold, fontSize: 17),
                              ),
                              trailing: Text(
                                problem.created_at,
                                style: TextStyle(
                                    fontWeight: FontWeight.bold, fontSize: 16),
                              ),
                            ),
                          );
                        }));
                  }
                  return Center(
                    child: CircularProgressIndicator(),
                  );
                },
              ),
            )
          ],

Solution

  • You can some changes in imagenetwork url :

    leading: CircleAvatar(
      backgroundImage: NetworkImage(
        'http://192.168.1.148/skc/Problem_image/${problem.image}',
      ),
    ),