You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 25, 2022. It is now read-only.
abstract class Classifier implements NamedElement {}
abstract class GenericType
implements Built<GenericType, GenericTypeBuilder>, Classifier {
Classifier get base;
BuiltMap<TypeParameter, Classifier> get genericTypeValues;
...
}
Properties like base and genericTypeValues need to use the abstract type Classifier. The Json serialiser generator doesn't cope with this so I needed to create a custom serialiser
Serializers serializers =
(_$serializers.toBuilder()..add(_classifierSerializer)).build();
//final x = new SerializersBuilder()..;
final _ClassifierSerializer _classifierSerializer = new _ClassifierSerializer();
class _ClassifierSerializer implements StructuredSerializer<Classifier> {
@override
Classifier deserialize(Serializers serializers, Iterable serialized,
{FullType specifiedType: FullType.unspecified}) {
return serializers.deserialize(serialized);
}
@override
Iterable serialize(Serializers serializers, Classifier object,
{FullType specifiedType: FullType.unspecified}) {
return object != null ? serializers.serialize(object) : [];
}
@override
Iterable<Type> get types => [Classifier];
@override
String get wireName => 'Classifier';
}
The text was updated successfully, but these errors were encountered:
See google/built_value.dart#22
I was forced to create a custom serialiser (https://github.com/Andersmholmgren/vcore/blob/master/lib/src/model/model.dart#L118) because I have properties using a base type.
Properties like
base
andgenericTypeValues
need to use the abstract typeClassifier
. The Json serialiser generator doesn't cope with this so I needed to create a custom serialiserThe text was updated successfully, but these errors were encountered: