I currently face the problem is one class has two different path, but I only create one class.
I think the problem may be coming after I modify the directory name.
The class has two different path
The class current location
since I face this error:
type ‘MedicineController’ is not a subtype of type ‘MedicineController’ in type cast where
MedicineController is from package:elderly_app/src/Views/Elderly/feature/medicine/medicine_controller.dart
MedicineController is from package:elderly_app/src/views/elderly/feature/medicine/medicine_controller.dart
How to fix it? Thank you.
2
Answers
If you’re using vscode, restarting your dart analysis server should be enough.
If you’re using JetBrains, you should clear your editor’s cache and then restart the editor.
you have Two classes of same name and have imported both of them so dart can not decide which one to use. To solve this problem there are different methods some of them are:
hide
keyword:Hide the Class which from one file the flutter will use the other one just like below:
as
keyword:then use it like this
show
keyword:using the above it will only show ClassName in this file. and all other Classes will be hidden.