flutter 中不存在 URI

问题描述 投票:0回答:1

这是非常基本的问题,它让我发疯。

在主文件中的 flutter 中,我想导入我的“post_model”和“myapi”文件以使用它们的类。我无法导入它们。我不知道为什么!!!!!!!!!

这是我的文件的图片。我得到的错误..看看不允许我导入的红线!

错误是 URI 不存在。

enter image description here

我不明白的是,导入另一个文件(例如“在我的 api dart 中”)没有问题。

问题仅出现在 main.dart 文件中。!!

请帮助我。请.

enter image description here

android flutter dart import uri
1个回答
1
投票

首先,将 api 和 models 目录移动到 lib 目录中。

然后使用

package:<your application name>/model/post_model.dart
语法而不是相对路径。

© www.soinside.com 2019 - 2024. All rights reserved.