gpt4 book ai didi

annotations - Flutter 不可变类?

转载 作者:IT王子 更新时间:2023-10-29 07:01:20 25 4
gpt4 key购买 nike

IDE 已识别 StoreWatcher Flutter Widget 是不可变的。 @immutable 注释在哪里?它不在 store_watcher.dart 源代码中。

enter image description here

最佳答案

注释来自meta包裹

docs

Used to annotate a class C. Indicates that C and all subtypes of C must be immutable.

A class is immutable if all of the instance fields of the class, whether defined directly or inherited, are final.

Tools, such as the analyzer, can provide feedback if

the annotation is associated with anything other than a class, or a class that has this annotation or extends, implements or mixes in a class that has this annotation is not immutable.

并非所有注释都会引起预期的反馈。有些可能需要启用 linter规则。对于某些人来说,它可能只是计划但最终会得到分析器或 linter 的支持。

关于annotations - Flutter 不可变类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46170125/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com