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

registerFactoryParam should receive a Record #332

Open
feinstein opened this issue May 29, 2023 · 7 comments
Open

registerFactoryParam should receive a Record #332

feinstein opened this issue May 29, 2023 · 7 comments

Comments

@feinstein
Copy link

feinstein commented May 29, 2023

registerFactoryParam and registerFactoryParamAsync have a very limited API. We can only pass 2 parameters and their names aren't descritive enough of their purposes.

With Records added to dart 3, I think we can make a braking change to these methods where they receive a Record instead. This way we can define what are our parameters with a Record, since a Record signature is pretty much the same a Function's parameter signature.

@escamoteur
Copy link
Collaborator

escamoteur commented May 29, 2023 via email

@escamoteur
Copy link
Collaborator

Besides removing one parameter, there would be no need to change anything, as a gerenic type can alredy be a recoed, or do I miss something here?

@feinstein
Copy link
Author

I confess I still didn't play with Records, but as far as I understand yes, you only need to remove 1 parameter, so the function will only accept one generic parameter, then make it positional and not named, and then in the docs and readme explain how to use it with records.

@escamoteur
Copy link
Collaborator

unfortunately optional positional parameters can't be mixed with named ones yet. therefore we would need to keep it a named one because we always have to offer the 'instanceName` parameter.

@feinstein
Copy link
Author

Ah, OK, I didn't remember the parameters tbh, that's fine, I would just rename it to something else than param.

@escamoteur
Copy link
Collaborator

escamoteur commented May 30, 2023 via email

@feinstein
Copy link
Author

args... just kidding, I can't come up with a better name, I didn't realize we can't remove it.

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

No branches or pull requests

3 participants
@feinstein @escamoteur and others