Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: SerializersBuilder addAllBuilderFactories #1230

Open
jimmyff opened this issue Apr 14, 2023 · 2 comments
Open

Feature request: SerializersBuilder addAllBuilderFactories #1230

jimmyff opened this issue Apr 14, 2023 · 2 comments
Assignees
Labels

Comments

@jimmyff
Copy link

jimmyff commented Apr 14, 2023

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
Copy link
Collaborator

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.

@davidmorgan davidmorgan self-assigned this Apr 14, 2023
@jimmyff
Copy link
Author

jimmyff commented Apr 14, 2023

...of course you'd already thought of it! Thanks @davidmorgan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants