0
How can I add up the therebyValue' field - image below - using the Dart programming language in flutter? I tried to do as in the code below but it didn’t work.
RecuperarLista() async {
int a;
FirebaseAuth auth = FirebaseAuth.instance;
FirebaseUser usuarioLogado = await auth.currentUser();
Firestore db = Firestore.instance;
db.collection("meus Produtos").snapshots().listen(
( snapshot ){
for( DocumentSnapshot item in snapshot.documents ) {
var dados = item.data;
int somar=0;
somar =dados['Valor'].values.reduce((sum, element) => (sum + element));
print("somar do valor è"+ somar.toString());
}
It worked, thank you very much.
– Arquimedes