Closed
Description
From @ds84182 on February 28, 2016 18:13
For example, lets say you wanted to extend the JSON serializer to support value validation:
Something like this works just fine:
@JsonSerializable()
class ProtocolHandshake extends Object with _$ProtocolHandshakeMixin {
@Equals(47)
final int version;
//...
}
But something like this does not:
@JsonSerializable()
class ProtocolEntityData extends Object with _$ProtocolEntityDataMixin {
@KeyValidator(const TypeValidator(String))
@ValueValidator(const TypeValidator(String))
Map<String, String> data;
}
Or something using enums like this:
enum Side {
SERVER,
CLIENT
}
@PacketDef(target: Side.CLIENT)
class ProtocolIntList extends Object with _$ProtocolIntListMixin {
//...
}
Copied from original issue: dart-lang/source_gen#78