-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Import Method causing types to mismatch #33149
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
What is the location of the file that contains the Probably related to #33076 |
This is a flutter application so the main function sits in the main.dart file in the lib folder. The problem occured in a simple flutter application (only RxDart as a library) and I was able to recreate it with a clean flutter application. Execution is done as normal with flutter run --preview-dart-2 I'm not sure how relevant to #33076 this is, there is only the one entry point (though maybe I am just misreading the issue there). Edit: It is worth noting that the analyzer does pick up the error with the first error message:
and then either on hot reload or during execution you see the other two error messages:
|
Currently you must not use relative imports in |
The problem is not in Edit: Issue still occurs even if none of the types or files are referenced to in the Issue can also be replicated in a normal dart project. If you have a bin folder with a Obviously, if you do not import the files into main.dart you can't run the project and see the compiler error but the analyzer still shows the |
The problem does not depend on the name of the file, but just that it's an entry point for your program that you specify on the command line as a file path, and that it imports a package library without using a No file outside of the We hope to catch entry points inside |
Right here is a gist of the file structure and the code that was used in the pure dart example which yielded this bug. As you can see, there are no imports in main as mentioned multiple times before. I never mentioned anything about the names of these files (these names were made just to test the error; the error will occur regardless of what they are called). I am also not talking about dart "best practices"; I am talking about an error that is kicked back by the analyzer with mixed imports. Even if I delete the bin folder (that contains the main.dart file), the problem persists (no entry points). This image should better demonstrate what it is that I am talking about. Just to clarify, when I did have main.dart hooked up to this "library" It was in the bin folder and it used full package imports. Edit: I don't mean to come across as harsh; I just am half asleep and a bit cranky for other reasons. |
|
According to the gist, the |
Exactly. Even if I delete the entire Bin folder and remove Main.dart from the equation, the analyzer still kicks the error back. If I rebuild the entire thing as a library, the same thing also occurs. @zoechi the original bug was found in a flutter application. This gist and the picture an app used to experiment so that I could nail down the specifics of this bug. |
Ups, missed the |
@zoechi it's not a problem. Just trying to do my part for the community. Sorry accidentally hit the close issue button. |
Duplicate of #33076. |
Steps to recreate issue:
a.dart
withclass A
,b.dart
withclass B
andc.dart
withclass C
B(A())
for example.import A.dart
and import b from package:import package:test/B.,dart
If you change the Imports to all be from Path or all be from Package then the error goes away.
The text was updated successfully, but these errors were encountered: