I am trying to learn Dart language. Following code seems very straight forward but does not work. I know it may be a foolish question for an expert but for me hard to understand