skip to Main Content

enter image description here

I want to import the about.dart file in my main.dart file. But it is showing error while I’m copying its path. I tried many ways to import it, but all fails. Can anyone please help me in this?

2

Answers


  1. if both the files are in the same folder you can import them using this line

    import './dialpad.dart';
    

    if you want to import the file from a folder at the same level of the file in which you want to import you can use this line

    import '../widgets/some_file.dart';
    
    Login or Signup to reply.
  2. To use your local package you have to define package and give a package path inside your pubspec.yaml for the package.

    To add local package in pubspec.yaml:

      sip_up-0.5.6:
        path: ./sip_up-0.5.6
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search