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

Nested StreamBuilder not working #30

Open
saket1999 opened this issue Sep 6, 2020 · 0 comments
Open

Nested StreamBuilder not working #30

saket1999 opened this issue Sep 6, 2020 · 0 comments

Comments

@saket1999
Copy link

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();
                },
              ),
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant