构造函数能用
const就用const必填参数放在 可选参数 的 { } 里,并且用
@required标记非空属性加上断言,示例:
const Checkbox({Key key,@required this.value,this.tristate = false,@required this.onChanged,this.activeColor,this.checkColor,this.materialTapTargetSize,}) : assert(tristate != null),assert(tristate || value != null),super(key: key);
字段都是
final类型每个 field 、assert 都要换行
可选
- 复写
debugFillProperties()方法帮助debug时显示信息 - 实现
Semantics控件提供给视觉障碍的用户使用
