I have this list of int which has a length of 3
This is the list:
List<Tamount> integer= [
amount(amount: 2, id: '34'),
amount(amount: 4, id: '12'),
TotalAmount(amount: 2, id: '54'),
];
And I want to replace index 2 so the one with the amount of 4
I have tried this :
integer.isNotEmpty
? integer.remove(integer[1].id)
: null;
integers.insert(1, integer(
id: DateTime.now().toString(),
amount:34,
));
But it is not working ,for some reason it is not removing it from the list, but it is adding to the list.