Skip to content
This repository was archived by the owner on May 7, 2023. It is now read-only.
This repository was archived by the owner on May 7, 2023. It is now read-only.

Nested StreamBuilder not working #30

@saket1999

Description

@saket1999

When I am using two streambuilder of SelectBloc one inside another. The inner stream builder is not working.
The inner stream builder is always returning text widget.

StreamBuilder<List<Map>>(
                stream: filterBloc.items,
                builder: (BuildContext context, AsyncSnapshot filterSnapshot) {
                  if(filterSnapshot.hasData) {
                    if(filterSnapshot.data.length==0) {
                      return Center(
                        child: Text('Downloading Data'),
                      );
                    }
                    Map<String, int> filterMap = Map<String, int>();
                    for(int i=0; i<filterSnapshot.data.length; i++)
                      filterMap[filterSnapshot.data[i]['name']] = filterSnapshot.data[i]['enabled'];
                    return StreamBuilder<List<Map>>(
                      stream: modelBloc.items,
                      builder: (BuildContext context, AsyncSnapshot snapshot) {
                        if(snapshot.hasData) {
                          if(snapshot.data.length==0) {
                            return Center(
                              child: Text('Downloading Data'),
                            );
                          }
                          return ListView.builder(
                            shrinkWrap: true,
                            itemCount: snapshot.data.length,
                            itemBuilder: (context, index) {
                              Model item = Model().fromDb(snapshot.data[index]);
                              return ContestCard(size: size, item: item);
                            },
                          );
                        }
                        return Text('Loading');
                      },
                    );
                  }
                  return Container();
                },
              ),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions