Closed dark-chocolate closed 3 years ago
That sounds like a question for analyzer
https://github.com/dart-lang/sdk/issues/new
or linter
https://github.com/dart-lang/linter
:)
@dark-chocolate late final
are lazy initialized unlike final
. For instance try the following code in dartpad:
class A {
late final String a = (){print('init a'); return 'a';}();
final String b = (){print('init b'); return 'b';}();
}
main() {
A()..a..b;
}
@davidmorgan I'm so sorry for the wrong thread.
@a14n Right sir, I forgot the lazy initialization usage of it.
In the following example, you can see the class members
a
andb
are both initialized at the time of declaration. There's no benefit of marking themlate
as it is redundant. Can we show a lint warning here?