title: static const - top level of program does not allow static const - Dart
body: <p>I have looked at some other similar questions on SO, but they don't appear to address the following specifically.</p>
  
  <p>What I want to achieve is to have compile-time constants that cannot be altered.</p>
  
  <p>I have a program which I reorganized a little in order to de-clutter. The program had some const declarations prior to "main()". I moved these to a class, however it required that I declare them as "static const". I then thought, ok those other "const" declarations prior to "main()" should probably also be "static const". However when I attempted that, the Editor advised "Top-level declarations cannot be declared to be 'static'". EG.</p>
  
  <pre><code>static const int    I_CORRECT_YN       = 12;   // prompt nr.
  </code></pre>
  
  <p>So, I am a little confused. I thought that a "const" was static. Why do I have to declare "static" in the class? Why can't I declare a "top level" const as "static"? Also, what is the difference between:</p>
  
  <pre><code>static const int I_CORRECT_YN = 12;
  const  int       I_CORRECT_YN = 12;
  static final int I_CORRECT_YN = 12;
  final int        I_CORRECT_YN = 12;    ?
  </code></pre>
  
  <p>What is the best or only way to declare compile-time values that cannot be altered?</p>
  
  <p>I guess I am looking at the literal meaning, but I presume there is a more complex meaning.</p>