android - Flutter 在调试时抛出错误 - 编译器消息:lib/views/signUp.dart:1:8: Error: Not found: 'dart:html' import 'dart:html';
问题描述
Flutter 版本 1.17.4 我正在使用Android Studio 4.0使用macOS 10.15.5的 Mac
Android Studio 4.0 Build #AI-193.6911.18.40.6514223,于 2020 年 5 月 20 日构建
输入以下代码行后,编码运行顺利,调试时出现此错误。
signMeUp() {
if (formKey.currentState.validate()) {
setState(() {
isLoading = true;
});
authMethods.signUpWithEmailAndPassword(
emailTextEditingController.text, passwordTextEditingController.text);
}
当前的错误如下所示,我向那里的任何人寻求帮助,这是我的第一次颤抖,我进展不顺利。
Launching lib/main.dart on Lenovo TB3 850M in debug mode...
Running Gradle task 'assembleDebug'...
Compiler message:
lib/views/signUp.dart:1:8: Error: Not found: 'dart:html'
import 'dart:html';
^
../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/top_level.dart:1:8: Error: Not found: 'dart:html'
import 'dart:html';
^
../flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.2/lib/js.dart:8:1: Error: Not found: 'dart:js'
export 'dart:js' show allowInterop, allowInteropCaptureThis;
^
../flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.2/lib/js_util.dart:8:1: Error: Not found: 'dart:js_util'
export 'dart:js_util';
^
../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart:306:25: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
var nextWrapper = allowInterop((firebase_interop.UserJsImpl user) {
^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart:310:26: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
var errorWrapper = allowInterop((e) => _changeController.addError(e));
^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart:340:25: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
var nextWrapper = allowInterop((firebase_interop.UserJsImpl user) {
^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart:345:11: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop((e) => _idTokenChangedController.addError(e));
^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart:164:9: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
- 'DatabaseReference' is from 'package:firebase/src/database.dart' ('../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop((update) => jsify(transactionUpdate(dartify(update))));
^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart:166:26: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
- 'DatabaseReference' is from 'package:firebase/src/database.dart' ('../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
var onCompleteWrap = allowInterop(
^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart:301:24: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/database.dart' ('../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
var callbackWrap = allowInterop((database_interop.DataSnapshotJsImpl data,
^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart:325:30: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/database.dart' ('../flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
jsObject.once(eventType, allowInterop(
^^^^^^^^^^^^
^^^^^^^^^^^
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:567:37)
#2 writeDepfile (package:vm/kernel_front_end.dart:760:21)
<asynchronous suspension>
#3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:539:15)
<asynchronous suspension>
#4 _FlutterFrontendCompiler.compile (package:flutter_frontend_server/server.dart:40:22)
#5 starter (package:flutter_frontend_server/server.dart:178:27)
#6 main (file:///b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:8:30)
#7 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#8 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.
FAILURE: Build failed with an exception.
* Where:
Script '/Users/MAVERICK/AndroidStudioProjects/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 882
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/MAVERICK/AndroidStudioProjects/flutter/bin/flutter'' 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 3m 38s
Exception: Gradle task assembleDebug failed with exit code 1
解决方案
推荐阅读
- selenium - 在 jenkins 中调用 selenium-side-runner
- sql-server - SQL 语法错误:不能为 ROW_NUMBER() 绑定多部分标识符
- c# - 如何将数据库中的十进制值相加
- regex - 查看正则表达式以更新 mariaDB 列
- .net - log4net BufferingForwardingAppender appender 看起来在 .net core 2.1 中不起作用
- python - Keras模型只能预测一个类
- docker - 无法将文件从 docker 容器复制到 EC2 实例
- spring - 对于具有 ROLE_MANAGER 的用户,日历不显示
- url - 重复,提交的 URL 未被选为规范,而是采用移动网站的随机 URL
- c# - 如何在 .csproj 中引用 NuGet 包