-1
return Scaffold(
body: StreamBuilder(
stream: stream,
builder: (context, snapshot) {
if (snapshot.hasData) {
return ListView.builder(
itemCount: snapshot.data.docs.length,
itemBuilder: (context, index) {
var teste = snapshot.data.docs[index].data()['romaneioItens']
[index]['cliente'];
var teste1 = snapshot.data.docs[index].data()['romaneioItens']
[index]['enderecoEntrega'];
return ListTile(
title: Text(
teste['NomeFantasia'],
),
subtitle: Column(
children: [
Row(
children: [
Text(teste1['logradouro'] ?? ''),
Text(teste1['numero'] ?? ''),
Text(teste1['bairro'] ?? ''),
],
),
Row(
children: [
Text(teste1['cidade'] ?? ''),
Text(teste1['UF'] ?? ''),
],
),
Row(
children: [
Text(
snapshot.data.docs[index].data()['obsEnt'] ?? ''),
],
),
],
),
);
},
);
} else {
return Container();
}
},
),
);
My code is as above but in my itemcount when I give a print, it shows me 2 - and takes the first array value of every doc I have in my Collection in case I have two Docs - however, in my array there are 4 items. How do I get this value and pass in itemcount to correctly display the 4 items in my array?