Please I need help. I have a List whose item is a class with the different items (class variables). Here is my code
class ProductProvider with ChangeNotifier {
static List<Product> _items = [
**Product(
id: 'KIOEL9IKJD',
designId: 'Pack',
title: 'Varities',,
*price: 120,*
),**
Product(
id: 'KILE9IKDJK',
designId: 'Pack',
title: 'Cheeze',
price: 20),
Product(
id: 'LOIR9IOEHD',
designId: 'Fresh',
title: 'Berry',
price: 70,
),
];
List<Product> get items {
return [..._items];
}
}
Then, I used ListView.builder to send the data to a new screen when clicking on, now my problem is, in the new screen how can I dynamically (without saying _items[1].price) get its index so that I can update the only price of the item by a button click and also add the updated total price
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…