简体   繁体   English

lib/home.dart:2:8: 错误:未找到:'dart:html'

[英]lib/home.dart:2:8: Error: Not found: 'dart:html'

I am new here and facing issues with the Android studio.我是新来的,面临 Android 工作室的问题。 I try to run main.dart (both ios and android) and get this warning message我尝试运行 main.dart(ios 和 android)并收到此警告消息

** BUILD FAILED ** ** 构建失败 **

↳
Invalid depfile: /Users/przemek/AndroidStudioProjects/get_stared_app/.dart_tool/flutter_build/a0939d4e94e10e87373caa81ce1cf2b7/kernel_snapshot.d
Invalid depfile: /Users/przemek/AndroidStudioProjects/get_stared_app/.dart_tool/flutter_build/a0939d4e94e10e87373caa81ce1cf2b7/kernel_snapshot.d
Invalid depfile: /Users/przemek/AndroidStudioProjects/get_stared_app/.dart_tool/flutter_build/a0939d4e94e10e87373caa81ce1cf2b7/kernel_snapshot.d
Invalid depfile: /Users/przemek/AndroidStudioProjects/get_stared_app/.dart_tool/flutter_build/a0939d4e94e10e87373caa81ce1cf2b7/kernel_snapshot.d
lib/home.dart:2:8: Error: Not found: 'dart:html'
import "dart:html";
       ^
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml; message=StandardFileSystem only supports file:* and data:* URIs)
#0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7)
#1      asFileUri (package:vm/kernel_front_end.dart:659:37)
#2      writeDepfile (package:vm/kernel_front_end.dart:853:21)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:574:15)
<asynchronous suspension>
#4      _FlutterFrontendCompiler.compile (package:flutter_frontend_server/server.dart:43:22)
#5      starter (package:flutter_frontend_server/server.dart:182:27)
#6      main (file:///b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:9:30)
#7      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#8      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)


Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')```

What should I do to fix it? Many thanks for the help in the advance. I updated my Andorid studio this morning and since that time I have this issue

Try replacing dart:html with dart:io at the top of your main.dart file. Try replacing dart:html with dart:io at the top of your main.dart file.

The accepted answer does not always help.接受的答案并不总是有帮助。 Sometimes the use of universal_html is more suitable.有时使用universal_html更合适。 Just install the latest package and use the import as:只需安装最新的 package 并将导入用作:

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

the error can be due also to the import of these two if they are not used如果不使用这两个,则错误也可能是由于导入

import 'dart:html';
import 'dart:ui';

delete these imports and save删除这些导入并保存

暂无
暂无

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

相关问题 lib/Pages/ChattingPage.dart:15:8: 错误: 未找到: 'dart:html' import 'dart:html' as html; - lib/Pages/ChattingPage.dart:15:8: Error: Not found: 'dart:html' import 'dart:html' as html; 错误:未找到:“dart:html”导入“dart:html”; - Error: Not found: 'dart:html' import 'dart:html'; Flutter Dart 错误:Dart_LookupLibrary:找不到库“package:home_widget/home_widget_callback_dispatcher.dart” - Flutter Dart Error: Dart_LookupLibrary: library 'package:home_widget/home_widget_callback_dispatcher.dart' not found Dart 错误:Dart_LookupLibrary:找不到库“package:home_widget/home_widget_callback_dispatcher.dart” - Dart Error: Dart_LookupLibrary: library 'package:home_widget/home_widget_callback_dispatcher.dart' not found 错误:未找到:'dart:js' import 'dart:js'; - Error: Not found: 'dart:js' import 'dart:js'; 相关的导致错误的小部件是 Container lib\screens\home_screen.dart:18 - The relevant error-causing widget was Container lib\screens\home_screen.dart:18 出现“找不到目标文件”lib\main.dart“之类的错误。” 在 flutter 中构建 APK - Getting error like “Target file ”lib\main.dart“ not found.” whlie building APK in flutter 未找到:&#39;dart:html&#39; 导入 &#39;dart:html&#39;; 我不需要 dart:html 并且我也没有使用过,但是我尝试导入它,但是错误没有发生 - Not found: 'dart:html' import 'dart:html'; I don't need dart:html and I also didn't used, but I tried by importing it, but the error isn't going 错误:flutter/lib/ui/ui_dart_state.cc(209) - ERROR:flutter/lib/ui/ui_dart_state.cc(209) Flutter 构建失败:未找到:'dart:html' import 'dart:html' http-0.12.2 - Flutter Build failure: Not found: 'dart:html' import 'dart:html' http-0.12.2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM