This is the GitHub repository of the MyNotes application for the Free Flutter Course (https://www.youtube.com/playlist?list=PL6yRaaP0WPkVtoeNIGqILtRAgd3h2CNpT)
Hi, I am following the course and have a problem on notes view. StreamBuilder is in connection state done and doesn't display the notes from the list. In the course we are displaying with the state active.
Here is what I am doing:
body: FutureBuilder(
future: _notesService.getOrCreateUser(email: userEmail),
builder: (context, snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.done:
return StreamBuilder(
stream: _notesService.allNotes,
builder: (context, builder) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
case ConnectionState.active:
if (snapshot.hasData) {
final allNotes = snapshot.data as List;
return ListView.builder(
itemCount: allNotes.length,
itemBuilder: (context, index) {
final note = allNotes[index];
return ListTile(
title: Text(
note.text,
maxLines: 1,
softWrap: true,
overflow: TextOverflow.ellipsis,
),
);
},
);
} else {
return const CircularProgressIndicator();
}
Hi, I am following the course and have a problem on notes view. StreamBuilder is in connection state done and doesn't display the notes from the list. In the course we are displaying with the state active.
Here is what I am doing: body: FutureBuilder( future: _notesService.getOrCreateUser(email: userEmail), builder: (context, snapshot) { switch (snapshot.connectionState) { case ConnectionState.done: return StreamBuilder( stream: _notesService.allNotes, builder: (context, builder) { switch (snapshot.connectionState) { case ConnectionState.waiting: case ConnectionState.active: if (snapshot.hasData) { final allNotes = snapshot.data as List;
return ListView.builder(
itemCount: allNotes.length,
itemBuilder: (context, index) {
final note = allNotes[index];
return ListTile(
title: Text(
note.text,
maxLines: 1,
softWrap: true,
overflow: TextOverflow.ellipsis,
),
);
},
);
} else {
return const CircularProgressIndicator();
}