Why is this initialization of final fields wrong in Dart? Why is this initialization of final fields wrong in Dart? dart dart

Why is this initialization of final fields wrong in Dart?


Günter Zöchbauer already explained the reason for your error.

Here is a workaround:

Data(Step initializer(Map<String,List<double>> dataReferences))  : this._internal(initializer, new Map());Data._internal(initializer, map)  : _dataMap = map,    _updateStep = initializer(map);


You are reading from _dataMap (initializer(_dataMap)). _datamap is a field of this it is not an argument. You can't read fields from 'this' in constructor initializers as the error message says.