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
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';
To use your local package you have to define package and give a package path inside your pubspec.yaml for the package.
path
pubspec.yaml
To add local package in pubspec.yaml:
sip_up-0.5.6: path: ./sip_up-0.5.6
Click here to cancel reply.
2
Answers
if both the files are in the same folder you can import them using this line
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
To use your local package you have to define package and give a package
path
inside yourpubspec.yaml
for the package.To add local package in
pubspec.yaml
: