Feature request: SerializersBuilder addAllBuilderFactories
jimmyff opened this issue · 2 comments
jimmyff commented
When extending another packages' serializers you can addAll
their serializers however I don't think there is a way to add all their BuilderFactories?
It would be great if you can do this:
import 'package:foobar/foobar.dart' as mypackage;
// ...
final Serializers serializers = (_$serializers.toBuilder()
..addAll(mypackage.serializers.serializers)
..addAllBuilderFactories(mypackage.serializers.builderFactories);
).build();
It would also be nice to addAllPlugins too but this would be less useful.
davidmorgan commented
I think what you want is the merge
and mergeAll
methods
https://pub.dev/documentation/built_value/latest/serializer/SerializersBuilder/merge.html
https://pub.dev/documentation/built_value/latest/serializer/SerializersBuilder/mergeAll.html
They merge serializers and builder factories but not plugins.
jimmyff commented
...of course you'd already thought of it! Thanks @davidmorgan