ios 错误:未找到:将"dart:html"导入为html;

jaxagkaj  于 2022-11-19  发布在  iOS
关注(0)|答案(3)|浏览(171)

我得到了这个奇怪的错误在我的应用程序昨天当我试图运行它,我不能很明白如何修复它。它显示了很多错误行,这是没有发生过,我不知道出了什么问题。这里的错误

Invalid depfile: D:\Kuliah\Mata Kuliah\Pemrograman Mobile\medreminder.dart_tool\flutter_build\0e1b116fd39faa66306b0a2d36ef7692\kernel_snapshot.d
Invalid depfile: D:\Kuliah\Mata Kuliah\Pemrograman Mobile\medreminder.dart_tool\flutter_build\0e1b116fd39faa66306b0a2d36ef7692\kernel_snapshot.d
/D:/Software/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/js-0.6.4/lib/js.dart:8:1: Error: Not found: 'dart:js'
export 'dart:js' show allowInterop, allowInteropCaptureThis;
^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/plugin_registry.dart:66:8: Error: Method not found: 'webOnlySetPluginHandler'.
ui.webOnlySetPluginHandler(handleFrameworkMessage);
^^^^^^^^^^^^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/utils.dart:7:7: Error: Type 'AnchorElement' not found.final AnchorElement _urlParsingNode = AnchorElement();
^^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/utils.dart:20:7: Error: Type 'Element' not found.
final Element? _baseElement = document.querySelector('base');
^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/utils.dart:7:7: Error: 'AnchorElement' isn't a type.
final AnchorElement _urlParsingNode = AnchorElement();
^^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/utils.dart:7:39: Error: Method not found: 'AnchorElement'.
final AnchorElement _urlParsingNode = AnchorElement();
^^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/utils.dart:20:7: Error: 'Element' isn't a type.
final Element? _baseElement = document.querySelector('base');
^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/utils.dart:20:31: Error: Undefined name 'document'.
final Element? _baseElement = document.querySelector('base');
^^^^^^^^
lib/main.dart:7:8: Error: Not found: 'dart:html'
import 'dart:html' as html;
^
lib/Reminder/ui/home_reminder.dart:8:8: Error: Not found: 'dart:html'
import 'dart:html' as html;
^
/D:/Software/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_native_timezone-2.0.0/lib/flutter_native_timezone_web.dart:2:8: Error: Not found: 'dart:html'
import 'dart:html' as html;
^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart:13:8: Error: Not found: 'dart:html'
import 'dart:html' as html;
^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:6:8: Error: Not found: 'dart:html'
import 'dart:html' as html;
^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/utils.dart:5:8: Error: Not found: 'dart:html'
import 'dart:html';
^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:193:3: Error: Type 'html.Location' not found.
html.Location get _location => html.window.location;
^^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:195:3: Error: Type 'html.History' not found.
html.History get _history => html.window.history;
^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:198:28: Error: Type 'html.EventListener' not found.
void addPopStateListener(html.EventListener fn) {
^^^^^^^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:203:31: Error: Type 'html.EventListener' not found.
void removePopStateListener(html.EventListener fn) {
^^^^^^^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:193:39: Error: Undefined name 'window'.
html.Location get _location => html.window.location;
^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:195:37: Error: Undefined name 'window'.
html.History get history => html.window.history;
^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:198:33: Error: 'EventListener' isn't a type.
void addPopStateListener(html.EventListener fn) {
^^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:199:10: Error: Undefined name 'window'.
html.window.addEventListener('popstate', fn);
^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:203:36: Error: 'EventListener' isn't a type.
void removePopStateListener(html.EventListener fn) {
^^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:204:10: Error: Undefined name 'window'.
html.window.removeEventListener('popstate', fn);
^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart:79:48: Error: Type 'html.EventListener' not found.
external ui.VoidCallback addPopStateListener(html.EventListener fn);
^^^^^^^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart:48:14: Error: Method not found: 'allowInterop'.
getPath: allowInterop(strategy.getPath),
^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart:49:15: Error: Method not found: 'allowInterop'.
getState: allowInterop(strategy.getState),
^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart:50:26: Error: Method not found: 'allowInterop'.
addPopStateListener: allowInterop(strategy.addPopStateListener),
^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart:51:25: Error: Method not found: 'allowInterop'.
prepareExternalUrl: allowInterop(strategy.prepareExternalUrl),
^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart:52:16: Error: Method not found: 'allowInterop'.
pushState: allowInterop(strategy.pushState),
^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart:53:19: Error: Method not found: 'allowInterop'.
replaceState: allowInterop(strategy.replaceState),
^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart:54:9: Error: Method not found: 'allowInterop'.
go: allowInterop(strategy.go),
^^^^^^^^^^^^
/D:/Software/Flutter/flutter/packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart:79:53: Error: 'EventListener' isn't a type.
external ui.VoidCallback addPopStateListener(html.EventListener fn);
^^^^^^^^^^^^^
U
nhandled exception:
FileSystemException(uri=org-dartlang-u
ntranslatable-uri:dart%3Ahtml; message=StandardFileSystem only supports file:* and data:* URIs)
#0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file
syst
em.dart:34:7)
#1 asFileUri (package:vm/kernel_front_end.dart:659:37)
#2 writeDepfile (package:vm/kernel_front_end.dart:799
:21)

#3 FrontendCompiler.compile (package:frontend_s
erver/frontend_server.dart:625:9)

#4
starter (package:frontend_server/frontend_server.dart:1451:12)

#5 main (file:///C:/b/s/w/ir/x/w/sdk/pkg/frontend_serv
er/bin/frontend_server_starter.dart:10:14)

很多错误都有“错误:未找到:“dart:html”将“dart:html”作为html导入;“我在寻找一种方法来修复它,很多人建议删除导入dart:html在我的文件夹中,当我这样做时,错误仍然相同。如果有人知道如何修复这个问题,请帮助它对我来说意义重大。谢谢

n3h0vuf2

n3h0vuf21#

当你在代码中输入@required,dart不小心自动包含'dart:html'时,通常会发生这种情况。
如果你没有任何使用它,然后尝试删除它,然后它会工作。

jchrr9hc

jchrr9hc2#

尝试运行以下命令:

flutter clean
flutter packages get
dart pub get
lymnna71

lymnna713#

您很可能遇到dart:html无法在所有目标平台上使用的问题。它应该只用于Web开发。
检查此答案:https://stackoverflow.com/a/70642261/1151983

相关问题