繁体   English   中英

Flutter:如何查找错误位置,构建错误,未找到:'dart:html'?

[英]Flutter: How to find location for error, Build error, Not found: 'dart:html'?

我知道这是由于一些 web 库意外导入到移动部分,但是在哪里? 项目中没有提到导致问题的文件或代码行。 我的项目非常庞大,有很多依赖项。 我分别拥有移动和特定于 Web 的代码文件。 我想我在任何时候都混合过,现在无法找到它发生的位置。

有什么方法可以弄清楚吗? 有什么方法可以专门调试导致错误的文件吗?

    ../../../../../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/top_level.dart:1:8: Error: Not found: 'dart:html'
    import 'dart:html';
           ^

dart:html is only for web and since you cannot build apk or ios with it due to its hinderance and also want to use it due to web,so I would suggest you another solution which works perfectly.

使用universal_html :适用于所有平台的“dart:html”,包括 Flutter 和服务器端。 简化跨平台开发和 HTML / XML 处理。

dependencies:
universal_html: ^2.0.8

import 'dart:html' as html;

import 'package:universal_html/html.dart' as html;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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