The example illustrates the following statement from The Dart Programming Language book (http://amzn.com/0321927702):
Class variables are initialized lazily; the initializer of a class variable is executed the first time its getter is invoked — that is, the first time one attempts to read the variable
When foo is printed the first time, its value is 0. Then we access the A.bar field and its initializer updates the foo's value. The second time we print foo its value is already 1.
Find the runnable version at DartPad.
Created with <3 with dartpad.dartlang.org.