简体   繁体   中英

Usage of local dart library

I have created some local libraries in my dart lib directory. These libraries are visible in dart packages for each newly created folder in the web directory. However, when I attempt to access them using the dart's package nomenclature eg package:reg/name.dart, the system always generates an error.

I think I am missing something.

I have read http://pub.dartlang.org/doc/package-layout.html but this did not help me either.

You need to ensure that the name you're using as the package matches that in pubspec.yaml.

Eg. if in pubspec.yaml you have name: my_app and your file is at lib\\my_library.dart then you need to use import 'package:my_app/my_library.dart'; .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM