Git Product home page Git Product logo

Comments (6)

BodhiSun avatar BodhiSun commented on July 17, 2024 1

这个功能没错,类的finale变量(static final 修饰)确实可以实现延迟初始化, 看成实例变量只有finale修饰了。
不过,不知道英文官网为什么 不想描述这一功能点了。

from dart.cn.

AlexV525 avatar AlexV525 commented on July 17, 2024 1

无论是不是静态,理应都是延迟初始化的。
image

from dart.cn.

chenglu avatar chenglu commented on July 17, 2024

是的,这句话应该被删掉,应该是文档同步的时候上游做了修改但是中文没有及时改动,我马上发一个 PR 来解决这个问题。

from dart.cn.

BodhiSun avatar BodhiSun commented on July 17, 2024

image
从我的这个case中, '---initA---'是先于"will use aa"打印的,如果加上static修饰 才是"will use aa"先打印

from dart.cn.

AlexV525 avatar AlexV525 commented on July 17, 2024

从我的这个case中, '---initA---'是先于"will use aa"打印的,如果加上static修饰 才是"will use aa"先打印

因为没有经过 static 修饰的 aaVariableClass 的成员变量。final 修饰的成员变量是在构造时一同初始化的。顶层(或者说全局) final 变量和 static final 都是延迟初始化的。

移除译文的说明后已经没有误导信息了,如果要修改那么去掉 "类的 final 变量" 也符合条件。

from dart.cn.

BodhiSun avatar BodhiSun commented on July 17, 2024

👌

from dart.cn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.