当我将Flutter版本升级到1.7.8 + hotfix.3。时,我收到一些错误消息。
以下是消息:
Compiler message:
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/svg.dart:158:18: Error: The argument type 'String' can't be assigned to the parameter type 'DiagnosticsNode'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: 'picture failed to precache',
^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/src/picture_provider.dart:335:20: Error: The argument type 'String' can't be assigned to the parameter type 'DiagnosticsNode'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: 'while resolving a picture',
^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/src/picture_provider.dart:337:33: Error: The argument type 'Null Function(StringBuffer)' can't be assigned to the parameter type 'Iterable<DiagnosticsNode> Function()'.
- 'StringBuffer' is from 'dart:core'.
- 'Iterable' is from 'dart:core'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'Iterable<DiagnosticsNode> Function()'.
informationCollector: (StringBuffer information) {
^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/src/picture_provider.dart:432:31: Error: The argument type 'Null Function(StringBuffer)' can't be assigned to the parameter type 'Iterable<DiagnosticsNode> Function()'.
- 'StringBuffer' is from 'dart:core'.
- 'Iterable' is from 'dart:core'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'Iterable<DiagnosticsNode> Function()'.
informationCollector: (StringBuffer information) {
^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/src/picture_provider.dart:495:31: Error: The argument type 'Null Function(StringBuffer)' can't be assigned to the parameter type 'Iterable<DiagnosticsNode> Function()'.
- 'StringBuffer' is from 'dart:core'.
- 'Iterable' is from 'dart:core'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'Iterable<DiagnosticsNode> Function()'.
informationCollector: (StringBuffer information) {
^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/src/picture_provider.dart:559:31: Error: The argument type 'Null Function(StringBuffer)' can't be assigned to the parameter type 'Iterable<DiagnosticsNode> Function()'.
- 'StringBuffer' is from 'dart:core'.
- 'Iterable' is from 'dart:core'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'Iterable<DiagnosticsNode> Function()'.
informationCollector: (StringBuffer information) {
^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/src/picture_stream.dart:256:16: Error: The argument type 'String' can't be assigned to the parameter type 'DiagnosticsNode'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: context,
^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/src/picture_stream.dart:301:18: Error: The argument type 'String' can't be assigned to the parameter type 'DiagnosticsNode'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: 'resolving a single-frame picture stream',
^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/src/svg/parser_state.dart:399:35: Error: The argument type 'Null Function(StringBuffer)' can't be assigned to the parameter type 'Iterable<DiagnosticsNode> Function()'.
- 'StringBuffer' is from 'dart:core'.
- 'Iterable' is from 'dart:core'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'Iterable<DiagnosticsNode> Function()'.
informationCollector: (StringBuffer buff) {
^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/src/svg/parser_state.dart:408:22: Error: The argument type 'String' can't be assigned to the parameter type 'DiagnosticsNode'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: 'in _Element.clipPath',
^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/src/svg/parser_state.dart:798:31: Error: The argument type 'Null Function(StringBuffer)' can't be assigned to the parameter type 'Iterable<DiagnosticsNode> Function()'.
- 'StringBuffer' is from 'dart:core'.
- 'Iterable' is from 'dart:core'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'Iterable<DiagnosticsNode> Function()'.
informationCollector: (StringBuffer buff) {
^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/src/svg/parser_state.dart:809:18: Error: The argument type 'String' can't be assigned to the parameter type 'DiagnosticsNode'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: 'in parseSvgElement',
^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/src/utilities/errors.dart:8:32: Error: The argument type 'String' can't be assigned to the parameter type 'DiagnosticsNode'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: 'in $methodName',
^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/src/utilities/errors.dart:10:29: Error: The argument type 'Null Function(StringBuffer)' can't be assigned to the parameter type 'Iterable<DiagnosticsNode> Function()'.
- 'StringBuffer' is from 'dart:core'.
- 'Iterable' is from 'dart:core'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'Iterable<DiagnosticsNode> Function()'.
informationCollector: (StringBuffer buff) {
^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 665
* What went wrong:
Execution failed for task ':app:compileflutterBuildDebugX86'.
> 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 41s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
这是我的Flutter Doctor信息:
flutter doctor
医生摘要(要查看所有详细信息,请运行flutter doctor -v):[√] Flutter(频道稳定,v1.7.8 + hotfix.3,在Microsoft Windows上 [版本10.0.17134.885])[!] Android工具链-为Android开发 设备(Android SDK版本28.0.3)!某些Android许可证不是 公认。要解决此问题,请运行:flutter doctor --android-licenses
[√] Android Studio(3.2版)[!] IntelliJ IDEA社区 版本(版本2018.2)未安装X Flutter插件;这个 添加了Flutter特定的功能。 X Dart插件未安装; 这增加了Dart特定的功能。 [√] VS代码(1.36.1版)
[√]已连接的设备(1个可用)!医生发现了2类问题。
答案 0 :(得分:2)
在flutter_svg
中将pubspec.yml
的版本至少更新为0.13.0