In java, if you want to initialize a static variable once, you can write code in Static Initialization Block just like this:
abstract class Dummy {
static final Map<String, object> cache = new HashMap();
static {
cache.add('foo', new Foo());
cache.add('bar', new Bar());
}
}
Here I want to ask if there have a similar way in Dart? What is the best coding practice in Dart programming?
abstract class Dummy {
static final Map<String, dynamic> cache = <String, dynamic>{};
}