Comments (6)
这个功能没错,类的finale变量(static final 修饰)确实可以实现延迟初始化, 看成实例变量只有finale修饰了。
不过,不知道英文官网为什么 不想描述这一功能点了。
from dart.cn.
from dart.cn.
是的,这句话应该被删掉,应该是文档同步的时候上游做了修改但是中文没有及时改动,我马上发一个 PR 来解决这个问题。
from dart.cn.
从我的这个case中, '---initA---'是先于"will use aa"打印的,如果加上static修饰 才是"will use aa"先打印
from dart.cn.
从我的这个case中, '---initA---'是先于"will use aa"打印的,如果加上static修饰 才是"will use aa"先打印
因为没有经过 static
修饰的 aa
是 VariableClass
的成员变量。final
修饰的成员变量是在构造时一同初始化的。顶层(或者说全局) final
变量和 static final
都是延迟初始化的。
移除译文的说明后已经没有误导信息了,如果要修改那么去掉 "类的 final 变量" 也符合条件。
from dart.cn.
👌
from dart.cn.
Related Issues (20)
- [PAGE ISSUE]: '高效 Dart 语言指南:用法示例'
- [PAGE ISSUE]: '高效 Dart 语言指南:API 设计'
- GitHub Action build failed
- [PAGE ISSUE]: '获取 Dart SDK' HOT 2
- [PAGE ISSUE]: 'Dart 开发语言概览'
- [PAGE ISSUE]: 'Dart 开发语言概览'
- [PAGE ISSUE]: 'Dart 开发语言概览'
- [PAGE ISSUE]: 'Dart 开发语言概览'
- [PAGE ISSUE]: 'Dart 开发语言概览'
- [PAGE ISSUE]: 'Dart SDK 归档' CORS 问题
- [PAGE ISSUE]: 'Dart 速查表 codelab'
- [PAGE ISSUE]: 'Dart 概览' HOT 1
- [PAGE ISSUE]: '可迭代集合'
- [PAGE ISSUE]: 'Dart 开发语言概览'
- [PAGE ISSUE]: '创建 package'
- [翻译问题] {https://dart.cn/language/variables} HOT 2
- [页面问题] https://dart.cn/language/variables
- [页面问题] 变量
- [页面问题] 'Dart 概览' HOT 1
- [页面问题] Dart 速查表 codelab HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dart.cn.