flutter html 运行时错误

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

我尝试与 Open AI API 建立连接,并调用其中 2 个 3 次 1 for 2,另一个 1 次 API 没有任何错误或请求调用,所以我不知道为什么会出现此错误显示。

** flutter doctor -v 输出**

PS C:\Users\DC\Desktop\my_voiceassistant> flutter doctor -v
[√] Flutter (Channel stable, 3.3.10, on Microsoft Windows [Version 10.0.22621.2134], locale en-IN)
    • Flutter version 3.3.10 on channel stable at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 135454af32 (9 months ago), 2022-12-15 07:36:55 -0800
    • Engine revision 3316dd8728
    • Dart version 2.18.6
    • DevTools version 2.15.0

[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at C:\Users\DC\AppData\Local\Android\sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: C:\Program Files\Java\jdk-14.0.1\bin\java
    • Java version Java(TM) SE Runtime Environment (build 14.0.1+7)
    • All Android licenses accepted.

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.1.32210.238
    • Windows 10 SDK version 10.0.19041.0

[!] Android Studio (version 2022.1)
    • Android Studio at D:\android_studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    X Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[√] VS Code (version 1.81.1)
    • VS Code at C:\Users\DC\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.70.0

[√] Connected device (1 available)
    • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.2134]

[√] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

调试控制台输出


Invalid depfile: C:\Users\DC\Desktop\my_voiceassistant\.dart_tool\flutter_build\99298210eb4d63a485fe99bd982d2307\kernel_snapshot.d
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/speech_to_text-6.1.1/lib/speech_to_text_web.dart:3:8: Error: Not found: 'dart:html'
import 'dart:html' as html;
       ^
/C:/src/flutter/packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart:13:8: Error: Not found: 'dart:html'

import 'dart:html' as html;
       ^
/C:/src/flutter/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart:6:8: Error: Not found: 'dart:html'
import 'dart:html' as html;
       ^
/C:/src/flutter/packages/flutter_web_plugins/lib/src/navigation/utils.dart:5:8: Error: Not found: 'dart:html'
import 'dart:html';

       ^
U
nhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml; me
ssage=StandardFileSystem only supports file:* and data:* URIs)
#0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7)

#1      asFileUri (package:vm/kernel_front_end.d
art:659:37)
#2      writeDepfile (package:vm/kernel_front_end.dart:799:21)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:625:9)
<asynchronous suspension>
#4      starter (package:frontend_server/frontend_server.dart:1451:12)
<asynchronous suspension>
2

#
5      main (file:///C:/b/s/w/ir/x/w/sdk/pkg/frontend_server/bin/frontend_server_starter.dart:10:14)
<asynchronous suspension>
4

FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 8s
Exception: Gradle task assemble Debug failed with exit code 1
Exited (sigterm)

我尝试运行此错误,并尝试通过从 pub 缓存文件中删除 dart.html 来摆脱它,但它不起作用,并且有一个 Git hub 存储库,我从中获取知识,但仍然没有收到错误解决了还有另一个堆栈溢出请求,对于不同的请求有相同的错误,我还关闭了我的应用程序访问网络的方法,但仍然没有解决我的错误(如果可能的话)任何人都可以帮助我

感谢您浪费您宝贵的时间并经历我的错误。

flutter error-handling runtime cross-platform openai-api
1个回答
0
投票

我尝试从“OpenAPIService.dart”中删除 dart.html,这对我有用 我得到这个是因为我使用 URI 创建的参考在不同的平台上工作不同,对于 Web 平台,我必须编写带有源代码和更多提示的代码

如果有人之前解决过这个错误,并且有其他解决方案或逻辑,请随时回答此块

非常尊重您在这里浪费宝贵的时间。<3

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