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

Choose provider name with @Riverpod(name: 'providerName') #3958

Open
BenjiFarquhar opened this issue Jan 31, 2025 · 0 comments
Open

Choose provider name with @Riverpod(name: 'providerName') #3958

BenjiFarquhar opened this issue Jan 31, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request needs triage

Comments

@BenjiFarquhar
Copy link

BenjiFarquhar commented Jan 31, 2025

This would enhance developer experience where we have a model class SizeInfo, and we want a provider called sizeInfoProvider, but that would require a naming conflict between the model and the provider class to get the desired name when using code gen:

// naming conflict
@riverpod 
class SizeInfo extends _$SizeInfo{}

So we might declare the provider as this to avoid the naming conflict with the model and get the provider name that we want:

@Riverpod(name: 'sizeInfoProvider') // or omit 'Provider' and automatically add it to every provider name. 
class SizeInfoNotifier extends _$SizeInfoNotifier{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage
Projects
None yet
Development

No branches or pull requests

2 participants