Snippet:
class EnumClass {
final String name;
const EnumClass(this.name);
String toString() => name;
}
class Foo extends EnumClass {
static const Foo VALUE = Foo._('HIDDEN');
String get name => DateTime.now().toString();
const Foo._(String name) : super(name);
}
main() {
print(Foo.VALUE.name);
}
prints 'HIDDEN' in DDK but the current date in every other backend.
This is due to the way DDK generates constant objects. The constant field shadows the prototype's getter indirection. E.g.:
dart.defineLazy(CT, {
get C0() {
return C0 = dart.const({
__proto__: pb.Foo.prototype,
name: "HIDDEN"
});
}
});
Related issue: #37839