There are two types of Root widgets available for Flutter StatelessWidget and StatefulWidget. They both have their own certain task in flutter mobile app development. This error is mainly comes in Xcode editor. The @immutable error dose not effect the coding and did not interrupt the coding. This error only display on screen using a Sky blue underline and when we take the mouse cursor above it, it will display us complete error. So in this tutorial we would Flutter This class or a class which this class inherits from is marked as ‘@immutable’ Error Solution Android iOS example. This error is also known as Dart analysis warning.
Complete error Text:
This class (or a class which this class inherits from) is marked as ‘@immutable’, but one or more of its instance fields are not final: ClassName.itemsdart(must_be_immutable).
Contents in this project Flutter This class or a class which this class inherits from is marked as ‘@immutable’ Error Solution:
1. There are some coding thing are prefix in flutter and one of them is that, Stateless widgets are immutable so we have define all variables with Final keyword in root class. If we would define all the variables as Final then this error would remove from given class.
2. To remove the error we have to define all the variables as Final for example final String abc = 'hello';. To know more about this error solution you can read the Flutter official documentation here.