-
-
Notifications
You must be signed in to change notification settings - Fork 153
Get with type #298
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
Comments
I have the same question, how can we resolve instance by runtime type? |
This issue has been open for about 6 months, could someone please take a look at the pr? :) |
@esDotDev @dancamdev what are your thoughts on this? get_it used the generics from the beginning and I'm somewhat hesitant to add a type, although internally I do use is too. |
I'm not clear on the use cases, but if there are valid ones then I don't see how it would hurt to allow an optional type. |
Some people want to access objects at runtime with a variable type |
One question I have is, how can this be done in a typesafe way? I mean how can the analyzer control if the destination variable has the correct type? |
included in V7.6.0 |
I just stumbled again upon these lines assert(
type == null || type is T,
'The type you passed is not a $T. This can happen '
'if the receiving variable is of the wrong type, or you passed a gerenic type and a type parameter'); and I really wonder how any of you uses the option of passing a runtime type to get an object from get_it as it turns out this check will always fail if the receiving variable is defined with any other type than You should all have gotten a lot of assertion errors from that. |
Hi! :)
Is it possible to add support for type parameter to "get/call" etc. functions?
I also created a PR :)
example for get function:
Current implementation:
Expected implementation:
The text was updated successfully, but these errors were encountered: