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
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.
Below you'll see one of the sub-classes. When I run dart run build_runner build (as I do have some codegen in this project), it throws the following errors.
[SEVERE] built_value_generator:built_value on lib/data/wrappers/wrappers.dart:
Error in BuiltValueGenerator for /dsk360_command/lib/data/wrappers/wrappers.dart.
Please make the following changes to use built_value serialization:
<I'm skipping a bunch of errors since they're almost all the same.>
10. Declare TicketWrapper.serializer as: static Serializer<TicketWrapper> get serializer => _$ticketWrapperSerializer; got @override Serializer<TicketModel> get serializer => _$ticketWrapperSerializer;
The serializer codegen triggers for a class if any of its supertypes starts withBuilt, and there is a field called serializer.
I have no idea why it's like this, the value type generation only triggers if the interface is exactlyBuilt.
That looks like it should just be fixed, until then you can work around by renaming your class to anything that doesn't start with Built or renaming serializer. (Whoops).
Activity
davidmorgan commentedon Feb 22, 2024
The trigger for codegen is supposed to be implementing
Built.Could you please give an example of a class that triggers codegen that you expect to not trigger codegen?
Thanks :)
jlambright commentedon Feb 22, 2024
Below you'll see one of the sub-classes. When I run
dart run build_runner build(as I do have some codegen in this project), it throws the following errors.davidmorgan commentedon Feb 22, 2024
Oh, I see the problem.
The serializer codegen triggers for a class if any of its supertypes starts with
Built, and there is a field calledserializer.I have no idea why it's like this, the value type generation only triggers if the interface is exactly
Built.That looks like it should just be fixed, until then you can work around by renaming your class to anything that doesn't start with
Builtor renamingserializer. (Whoops).