-
Notifications
You must be signed in to change notification settings - Fork 190
Open
Labels
Description
Given the abstract class (as well as a mixin version of the code) any sub-classes seem to trigger code generation attempts. However, I'm creating a wrapper class that consumes Built generated classes. This seems like buggy behavior. Either that, or it highlights the need for some kind of @built_ignore() annotation.
abstract class BuiltJsonSerializable<T extends Built<T, V>,
V extends Builder<T, V>> {
Serializer<T> get serializer;
Map<String, dynamic> toJsonMap() => jsonDecode(toJsonString());
String toJsonString() => standardSerializers.toJson<T>(serializer, toModel());
T? toModel();
T? modelFromJsonString(String serialized) {
try {
T? model = standardSerializers.fromJson<T>(serializer, serialized);
return model;
} on DeserializationError catch (e) {
Get.log('[${T.toString()} DESERIALIZATION ERROR] ${e.toString()}');
return null;
}
}
}Reactions are currently unavailable