简体   繁体   中英

Target of URI doesn't exist: 'theme.dart', 'colors.dart', 'ink_well.dart', etc

Currently trying to run an example of a guitar tuner created with the 'flutter_fft' plugin, however, I'm receiving an error on some of my imports. I can see that all of these files exist inside my flutter folder but can't seem to access them?

Here are my imports and the error I am receivingmy imports and the error I am receiving我的进口和我收到的错误

But as you can see in this screenshot I do have all of those files available somewhere on my PC, and the material.dart import works fine? 导入文件可用

I've been trying to work this out for a while but after asking a question here the other day and getting an almost immediate, and extremely helpful response, I've decided to come here again. Thanks in advance.

When importing from a package (like flutter) you must first specify the package with a package: and then the path to the imports.

If you don't specify this, dart will assume you are trying to import a file on the same directory as the current file.

so instead of import 'button_style.dart'; it should be import package:flutter/src/material/button_style.dart .

The above will work, but I will let you know that the sole purpose of importing package:flutter/material.dart; is to automatically import every file inside the material directory, and so, all of your imports are useless if you already import material.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