-
Notifications
You must be signed in to change notification settings - Fork 36
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
Generated file messages_all.dart produce an ERROR: 'lib' isn't a function. #492
Comments
Yes, the problem is that even though you said --no-use-deferred-loading it's generating an initialize that's trying to do a deferred load. Simple workaround is use deferred loading temporarily. Slightly more complicated, I think if you hand-edit the generated code and have it only do the then() part, that should work. |
The same result for command:
messages_all.dart:
Only difference between those two modes is:
|
I have changed implementation of
But it seams more like a workaround:) |
Yes, it's certainly a workaround. When you say you're compiling this, what are you using to compile it? The error message that something isn't a function doesn't seem like one that comes from the VM. I'd expect the error message that something doesn't have the method 'call'. But also, it seems like there's no way that lib is not in fact a function. So this may actually be a bug or limitation of the thing you're using to compile. Possibly something doesn't think that Function is a function and wants something more specific. |
You could try upgrading your Dart plugin. I have 163.15188.8 I pasted your code directly in and it doesn't complain for me in WebStorm 2016.3.5 with that plugin and Flutter 12.1 (although I wouldn't expect Flutter to make a difference). |
I have the same problem even with Dart plugin 171.4424.63 and Flutter 13.1
Maybe it would be possible to add this to autogenerated messages_all as a better workaround? |
Ah, it's the enable-strict-call-checks which does it, causing the analyzer to emit a false positive. Adding a null check wouldn't help. The problem is that with strict call checking it doesn't think something of type Function can be called. An appropriate fix would be a more specific type on the map. But not using enable-strict-call-checks would also work. |
From the other bug, it seems like the behavior of that option is likely to change anyway. |
Seems that both options need to be present otherwise |
Seems that code analysis can be configured using config file: https://www.dartlang.org/guides/language/analysis-options |
It's not obvious where that option would be set. @devoncarew , do you know? It doesn't seem to appear in any relevant source code. Excluding generated files from analysis seems reasonable. |
Yes, you can use |
Seems that excluding is currently broken in |
Yes, there does appear to be a problem with exclude. I saw it the other day but it went away when I restarted the server, so there might be a work-around. |
Published a 0.15.0 that should fix this, among other things. |
File generated by command
intl_translation:generate_from_arb
fails to compile with an error'lib' isn't a function. messages_all.dart:29
Command:
messages_all.dart:
The text was updated successfully, but these errors were encountered: