importing controller in flutter causes could not resolve package error

56 views Asked by At

New to flutter, migrating existing flutter 2.7 code to 3, for this, I created new app from the scratch in flutter 3 and then copy pasted all the files under /lib folder from existing 2.7 code and then copied all dependencies from existing pubspec.yaml, then executed flutter upgrade to upgrade all dependencies to latest version. Then when I ran flutter run command getting many such below errors. Kindly help

Error: Couldn't resolve the package 'sixam_mart' in 'package:sixam_mart/controller/auth_controller.dart'

I see the above error caused by below import statement in dart module

import 'package:sixam_mart/controller/auth_controller.dart';

I can see the auth_controller.dart exists in the same project, but not understanding why the code is importing the modules that are existing in same project? Please help me understand. I think the code must be looking to import the module from package:sixam_mart which is not the same project, but I can see the auth_controller.dart exist in same project. Is this code structure issue? or am I missing the concept. Please help! Thank you

UPDATE

The issue is with name property in pubspec.yaml which is now resolved after changing the name property to sixam_mart, thanks to @ShahedEmon this fix could have taken longer for me being new to Flutter

0

There are 0 answers