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
The appDatabase will create the appDatabaseProvider function, as expected. My first annoyance is that this name, appDatabase, still exists. It's still something my IDE will suggest I use. And if I name my variable that way, there is shadowing going on, and if I forget to declare a variable, using that name will either give poor error message or I will get weird suggestions because I'm actually using an unexpected function.
There is also a AbcRef that adds noise, but that's deprecated so it will hopefully get fixed in the future.
This is worst with families such as groupDetails. In addition to groupDetails itself being name pollution, we get a the classes GroupDetailsFamily and GroupDetailsProvider and their constructors, which will, again, often appear in the IDE suggestions.
For the MainAppDatabase class, it's not that bad. Only this class we are not meant to directly refer to is pollution...
I don't know if some of those intermediary things can be avoided. An idea I have is that when using @riverpod with a function, maybe there could be a special prefix that gets stripped from the generated provider method? For example:
It's a bit ugly, but this moves the annoying and useless names out of what is likely to be seen. A similar thing could be done for Notifiers. This is nearly backward compatible since this logic is optional... What are the chances someone prefixed their proviers with rvp$...?
This may sound like a minor thing, and it is... But it's annoying enough for me to consider using the non-codegen way... Which i've since discovered is not compatible... (annoying too!)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I like the idea of the codegen but have some annoyances with it I may or may not be alone having. A big one is namespace pollution.
Here are two examples:
The
appDatabasewill create theappDatabaseProviderfunction, as expected. My first annoyance is that this name,appDatabase, still exists. It's still something my IDE will suggest I use. And if I name my variable that way, there is shadowing going on, and if I forget to declare a variable, using that name will either give poor error message or I will get weird suggestions because I'm actually using an unexpected function.There is also a
AbcRefthat adds noise, but that's deprecated so it will hopefully get fixed in the future.This is worst with families such as
groupDetails. In addition togroupDetailsitself being name pollution, we get a the classesGroupDetailsFamilyandGroupDetailsProviderand their constructors, which will, again, often appear in the IDE suggestions.For the
MainAppDatabaseclass, it's not that bad. Only this class we are not meant to directly refer to is pollution...I don't know if some of those intermediary things can be avoided. An idea I have is that when using @riverpod with a function, maybe there could be a special prefix that gets stripped from the generated provider method? For example:
It's a bit ugly, but this moves the annoying and useless names out of what is likely to be seen. A similar thing could be done for Notifiers. This is nearly backward compatible since this logic is optional... What are the chances someone prefixed their proviers with
rvp$...?This may sound like a minor thing, and it is... But it's annoying enough for me to consider using the non-codegen way... Which i've since discovered is not compatible... (annoying too!)
Beta Was this translation helpful? Give feedback.
All reactions