constantInitializer property

Expression? constantInitializer

If this element represents a constant variable, and it has an initializer, a copy of the initializer for the constant. Otherwise null.

Note that in correct Dart code, all constant variables must have initializers. However, analyzer also needs to handle incorrect Dart code, in which case there might be some constant variables that lack initializers.


Expression? get constantInitializer => null;