gpt4 book ai didi

android - 错误 : The argument type 'void Function(ImageInfo, bool)' can't be assigned to the parameter type 'ImageStreamListener'

转载 作者:IT老高 更新时间:2023-10-28 12:38:00 33 4
gpt4 key购买 nike

升级 flutter run 后,应用无法运行。我升级是因为 ImageStreamListener

我试图改变不同的 channel [master, stable, dev] 并且不起作用。

我找到了 this Flutter 中的问题,但没有帮助。

这是我的 flutter 医生

[✓] Flutter (Channel unknown, v1.7.11, on Mac OS X 10.14.5 18F132, locale en-PE)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 10.2.1)
[✓] iOS tools - develop for iOS devices
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.4)
[!] IntelliJ IDEA Ultimate Edition (version 2019.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.36.0)
[✓] Connected device (3 available)

还有错误提示

Compiler message:                                                       
file:///Users/enzoftware/Development/flutter/.pub-cache/hosted/pub.dartlang.org/palette_generator-0.1.1/lib/palette_generator.dart:188:29: Error: The argument type 'void Function(ImageInfo, bool)' can't be assigned to the parameter type 'ImageStreamListener'.
- 'ImageInfo' is from 'package:flutter/src/painting/image_stream.dart' ('file:///Users/enzoftware/Development/flutter/packages/flutter/lib/src/painting/image_stream.dart').
- 'ImageStreamListener' is from 'package:flutter/src/painting/image_stream.dart' ('file:///Users/enzoftware/Development/flutter/packages/flutter/lib/src/painting/image_stream.dart').
Try changing the type of the parameter, or casting the argument to 'ImageStreamListener'.
stream.removeListener(imageListener);
^
file:///Users/enzoftware/Development/flutter/.pub-cache/hosted/pub.dartlang.org/palette_generator-0.1.1/lib/palette_generator.dart:194:31: Error: The argument type 'void Function(ImageInfo, bool)' can't be assigned to the parameter type 'ImageStreamListener'.
- 'ImageInfo' is from 'package:flutter/src/painting/image_stream.dart' ('file:///Users/enzoftware/Development/flutter/packages/flutter/lib/src/painting/image_stream.dart').
- 'ImageStreamListener' is from 'package:flutter/src/painting/image_stream.dart' ('file:///Users/enzoftware/Development/flutter/packages/flutter/lib/src/painting/image_stream.dart').
Try changing the type of the parameter, or casting the argument to 'ImageStreamListener'.
stream.removeListener(imageListener);
^
file:///Users/enzoftware/Development/flutter/.pub-cache/hosted/pub.dartlang.org/palette_generator-0.1.1/lib/palette_generator.dart:201:24: Error: The argument type 'void Function(ImageInfo, bool)' can't be assigned to the parameter type 'ImageStreamListener'.
- 'ImageInfo' is from 'package:flutter/src/painting/image_stream.dart' ('file:///Users/enzoftware/Development/flutter/packages/flutter/lib/src/painting/image_stream.dart').
- 'ImageStreamListener' is from 'package:flutter/src/painting/image_stream.dart' ('file:///Users/enzoftware/Development/flutter/packages/flutter/lib/src/painting/image_stream.dart').
Try changing the type of the parameter, or casting the argument to 'ImageStreamListener'.
stream.addListener(imageListener);
^
Compiler failed on /Users/enzoftware/Projects/Wibo/wibo-flutter-mobile-user/lib/main.dart

FAILURE: Build failed with an exception.

* Where:
Script '/Users/enzoftware/Development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 652

* What went wrong:
Execution failed for task ':app:compileflutterBuildDebugArm'.
> Process 'command '/Users/enzoftware/Development/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 29s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 29.7s
Gradle task assembleDebug failed with exit code 1

提前致谢。

最佳答案

该 API 最近发生了重大变化。

这是一个新旧用法的例子

    // get the width, height
Image image = new Image.file(myImageFile);
Completer<ImageInfo> completer = Completer();

// Old API
// image.image
// .resolve(new ImageConfiguration())
// .addListener((ImageInfo info, bool _) {
// completer.complete(info);
// });

// New API
image.image
.resolve(new ImageConfiguration())
.addListener(ImageStreamListener((ImageInfo info, bool _) {
completer.complete(info);
}));

// wait for ImageInfo to finish
ImageInfo imageInfo = await completer.future;

关于android - 错误 : The argument type 'void Function(ImageInfo, bool)' can't be assigned to the parameter type 'ImageStreamListener' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56957461/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com