How can i calculate total price of a List of items ? i am try tow way :

FutureBuilder<ProModel>(
  future: futurePro,
  builder: (context, snapshot){
  if(snapshot.hasData){
    snapshot.data.pro.forEach((element) {
    subTotal = subTotal + int.parse(element.amount);
    });
  }
}

and

FutureBuilder<ProModel>(
  future: futurePro,
  builder: (context, snapshot){
  if(snapshot.hasData){
    for (int i = 0; i < snapshot.data.pro.length; i++) {
     subTotal = subTotal + int.parse(snapshot.data.pro[i].amount);
    }
  }
}

but it calculate infinity

I/flutter ( 3885): t: 100
I/flutter ( 3885): t: 200
I/flutter ( 3885): t: 300
I/flutter ( 3885): t: 400
I/flutter ( 3885): t: 500
I/flutter ( 3885): t: 600
... to infinity 

its my first time for using FutureBuilder widget :) any a suggestion would be great.