I have a modifiable list (I did not set the list to have a fixed size) but run into this error
Unsupported operation: Cannot add to an unmodifiable list
The source code that throws this error is:
for (int i = 0; i < globals.produkte.length; i++){
globals.produkte[i].kategorienBool.add(false);
}
kategorienbool
is a List of bool with no fixed size.
This is how kategorienBool is defined in my class Produkte:
List<bool> kategorienBool;
Produkt({
required this.zutat,
required this.menge,
this.mhd,
this.verfaelltInXTagen,
this.einheit = "g",
this.anlage,
this.kategorien = const ["keine"],
this.kategorienBool = const [false],
this.offen = false,
this.color = const Color.fromRGBO(0, 0, 0, 1)
});
Can someone give me a hint what I might be doing wrong?
I also red that this seems to be a problem other people already had within the last 4 weeks AND I even found github posts from people which had this issue like 2 years ago but it had been fixed at that time.
The question is now: Is this a new issue or am I just doing something wrong?