- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在我的聊天应用程序中使用语音转文本和文本转语音功能来制作语音消息。我完全遵循了这个文档 https://pub.dev/packages/flutter_tts/example .但我不得不导入另一个名为 flutter_tts_web.dart 的库。我认为这应该没什么大不了的,但它似乎导致了大错误。这是堆栈跟踪
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_tts-1.2.6/lib/flutter_tts_web.dart:2:8: Error: Not found: 'dart:html'
import 'dart:html' as html;
^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_tts-1.2.6/lib/flutter_tts_web.dart:3:8: Error: Not found: 'dart:js'
import 'dart:js';
^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_tts-1.2.6/lib/flutter_tts_web.dart:31:3: Error: Type 'html.SpeechSynthesis' not found.
html.SpeechSynthesis synth;
^^^^^^^^^^^^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_tts-1.2.6/lib/flutter_tts_web.dart:32:3: Error: Type 'html.SpeechSynthesisUtterance' not found.
html.SpeechSynthesisUtterance utterance;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_tts-1.2.6/lib/flutter_tts_web.dart:31:8: Error: 'SpeechSynthesis' isn't a type.
html.SpeechSynthesis synth;
^^^^^^^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_tts-1.2.6/lib/flutter_tts_web.dart:32:8: Error: 'SpeechSynthesisUtterance' isn't a type.
html.SpeechSynthesisUtterance utterance;
^^^^^^^^^^^^^^^^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_tts-1.2.6/lib/flutter_tts_web.dart:37:17: Error: Method not found: 'SpeechSynthesisUtterance'.
utterance = html.SpeechSynthesisUtterance();
^^^^^^^^^^^^^^^^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_tts-1.2.6/lib/flutter_tts_web.dart:38:18: Error: Getter not found: 'window'.
synth = html.window.speechSynthesis;
^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_tts-1.2.6/lib/flutter_tts_web.dart:156:63: Error: 'JsArray' isn't a type.
context['speechSynthesis'].callMethod('getVoices') as JsArray<dynamic>;
^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_tts-1.2.6/lib/flutter_tts_web.dart:156:9: Error: The getter 'context' isn't defined for the class 'FlutterTtsPlugin'.
- 'FlutterTtsPlugin' is from 'package:flutter_tts/flutter_tts_web.dart' ('../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_tts-1.2.6/lib/flutter_tts_web.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'context'.
context['speechSynthesis'].callMethod('getVoices') as JsArray<dynamic>;
^^^^^^^
/C:/flutter/packages/flutter_web_plugins/lib/src/plugin_registry.dart:29:5: Error: Method not found: 'webOnlySetPluginHandler'.
ui.webOnlySetPluginHandler(_binaryMessenger.handlePlatformMessage);
^^^^^^^^^^^^^^^^^^^^^^^
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_proto
type/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:///C:/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)
FAILURE: Build failed with an exception.
* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 896
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\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 1m 38s
Exception: Gradle task assembleDebug failed with exit code 1
我试图删除文件,但变量 Tts State 取决于网络文件。 A;所以尝试了 flutter clean 并切换到 beta chanel。请尽快提供帮助,因为这是一场编程马拉松,我还有 8 个小时。我将几乎立即提供任何必要的代码
最佳答案
我认为这是因为 dart 没有安装,请确保你正确安装了 dart,并在安装 dart 后使用以下命令。
pub get
关于flutter - 飞镖 :tml and dart:js not found error flutter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63544616/
如何返回 Future ? Future deleteAll(List stuff){ stuff.forEach( s => delete(s)); //How do I r
上下文 我正在尝试为 angular2 dart 构建一个菜单组件。 这是一个截图: Menu screenshot -> 更多关于下面“问题”标题后菜单项的蹩脚格式 我有一个用于预览的 AppCom
我试过在 Flutter 中使用 Parser HTML 包,但我试过编译,返回了这个错误: import 'package:flutter/material.dart'; import 'packa
我试过在 Flutter 中使用 Parser HTML 包,但我试过编译,返回了这个错误: import 'package:flutter/material.dart'; import 'packa
如何在作用域模型的作用域模型后代的小部件中运行动画。我这里有一个红色按钮,单击它会显示一个正方形。正方形在 3 秒后消失,这恰好很快。我想要做的是让广场在几秒钟内消失。我尝试了 AnimationCo
我正在尝试在我的聊天应用程序中使用语音转文本和文本转语音功能来制作语音消息。我完全遵循了这个文档 https://pub.dev/packages/flutter_tts/example .但我不得不
我为 StatefulWidget 声明了一个类变量 - 在下面的代码中它是 someString。是否可以在 build(...) 方法中使用此变量而不将其声明为静态变量? class MyClas
我为 StatefulWidget 声明了一个类变量 - 在下面的代码中它是 someString。是否可以在 build(...) 方法中使用此变量而不将其声明为静态变量? class MyClas
我写了一个简单的 nodejs ws客户端连接时提供二进制 jpeg 文件的 websocket 服务器如下: import WebSocket = require("ws"); console.lo
起初可以工作,但在我进行了一些 flutter 升级后,它给出了一条错误消息。 我当前的 flutter 版本,0.10.2 class MainModel extends Model with Co
我是一名优秀的程序员,十分优秀!