title: Final and top-level lazy initialization
body: <p><strong>Please help me to understand what it exactly means:</strong></p>
  
  <p>Quote from the <a href="https://www.dartlang.org/guides/language/language-tour#final-and-const" rel="noreferrer">"Chapter 2. A Tour of the Dart Language"</a></p>
  
  <blockquote>
    <p>A local, top-level, or class variable that’s declared as final is initialized the first time it’s used</p>
  </blockquote>
  
  <p>So this is my test code:</p>
  
  
  
  <pre class="lang-dart prettyprint-override"><code>lazyTest(msg) =&gt; print(msg);
  
  class Printer{
    Printer(msg){
      print(msg);
    }
    final finalClassVariable = lazyTest("final class variable");
  }
  
  var globalsAreLazy = lazyTest("top-level");
  var lazyInitialized = lazyTest("lazy initialized");
  
  void main() {
  
     final localFinal = new Printer("local final");
     var initialize = lazyInitialized;
  }
  </code></pre>
  
  <p>Output:</p>
  
  <blockquote>
    <p>final class variable<br>
    local final<br>
    lazy initialized    </p>
  </blockquote>
  
  <p>Both <code>finalClassVariable</code> and <code>localFinal</code>  initialized and only <code>globalsAreLazy</code> wasn't. <code>lazyInitialized</code> was initialized on access as i expected.</p>