Dart 从lib子目录加载web组件

Dart 从lib子目录加载web组件,dart,dart-webui,Dart,Dart Webui,当尝试将webcomponent的html文件插入到我的应用程序库的views目录时,web_ui编译器会抛出消息 FileIOException: Cannot retrieve full path for file 'lib\src\view\entity\base\packages' (OS Error: The system cannot find the file specified. 这是意料之中的事吗?如果没有,我应该怎么做来修复错误?因为我没有看到您的代码或项目,这只是一种预感

当尝试将webcomponent的html文件插入到我的应用程序库的views目录时,web_ui编译器会抛出消息

FileIOException: Cannot retrieve full path for file 'lib\src\view\entity\base\packages' (OS Error: The system cannot find the file specified.

这是意料之中的事吗?如果没有,我应该怎么做来修复错误?

因为我没有看到您的代码或项目,这只是一种预感。我相信您的web组件HTML文件以错误的方式导入了一些组件

请尝试以下结构:

/lib/src/view/foo/foo.html
/lib/src/view/foo/foo.dart

/lib/src/view/bar/bar.html
/lib/src/view/bar/bar.dart
和内部
foo.html

<!DOCTYPE html>
<html>
  <head>
    <link rel="components" href="../bar/bar.html" />
  </head>
<body>
  <element name="x-foo" constructor="FooComponent" extends="div">
    <template>
      ...
    </template>
    <script type="application/dart" src="foo.dart"></script>
  </element>
</body>
</html>

...
请注意,我没有在
foo.html
中使用