简体   繁体   English

我的 flutter 应用程序中有太多黄线

[英]I am having too many yellow lines in my flutter app

I have flutter app and I have to make clean code with 0 errors.我有 flutter 应用程序,我必须编写干净的代码,错误为 0。

When I remove const from constructor in stateless widget it throw me yellow line error like bellow:当我从无状态小部件的构造函数中删除 const 时,它会抛出如下黄线错误:

This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: PerytonDropDown.selected此 class(或此 class 继承自的 class)被标记为“@immutable”,但其一个或多个实例字段不是最终的:PerytonselectedDro

I don't know how to deal with it.我不知道如何处理它。 Can anyone help me to resolve this issue?谁能帮我解决这个问题?

it is very simple, just initialize your variable with final .这很简单,只需用final初始化你的变量。

Like Below:如下:

final String text;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM