gpt4 book ai didi

升级后 Flutter 不再工作

转载 作者:IT王子 更新时间:2023-10-29 06:37:59 26 4
gpt4 key购买 nike

我的项目运行完美,就在今天,我升级了我的 Flutter,然后一切都开始运行了。

底部是他们给我的错误。请帮助我。

file:///Users/macbook/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/animated_background-1.0.4/lib/image_helper.dart:17:30: Error: The argument type 'dynamic Function(ImageInfo, bool)' can't be assigned to the parameter type 'ImageStreamListener'.
- 'ImageInfo' is from 'package:flutter/src/painting/image_stream.dart' ('file:///Users/macbook/Documents/flutter/packages/flutter/lib/src/painting/image_stream.dart').
- 'ImageStreamListener' is from 'package:flutter/src/painting/image_stream.dart' ('file:///Users/macbook/Documents/flutter/packages/flutter/lib/src/painting/image_stream.dart').
Try changing the type of the parameter, or casting the argument to 'ImageStreamListener'.
newStream.removeListener(listener);
^
file:///Users/macbook/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/animated_background-1.0.4/lib/image_helper.dart:20:25: Error: The argument type 'dynamic Function(ImageInfo, bool)' can't be assigned to the parameter type 'ImageStreamListener'.
- 'ImageInfo' is from 'package:flutter/src/painting/image_stream.dart' ('file:///Users/macbook/Documents/flutter/packages/flutter/lib/src/painting/image_stream.dart').
- 'ImageStreamListener' is from 'package:flutter/src/painting/image_stream.dart' ('file:///Users/macbook/Documents/flutter/packages/flutter/lib/src/painting/image_stream.dart').
Try changing the type of the parameter, or casting the argument to 'ImageStreamListener'.
newStream.addListener(listener);
^
file:///Users/macbook/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/animated_background-1.0.4/lib/image_helper.dart:21:41: Error: The argument type 'dynamic Function(ImageInfo, bool)' can't be assigned to the parameter type 'ImageStreamListener'.
- 'ImageInfo' is from 'package:flutter/src/painting/image_stream.dart' ('file:///Users/macbook/Documents/flutter/packages/flutter/lib/src/painting/image_stream.dart').
- 'ImageStreamListener' is from 'package:flutter/src/painting/image_stream.dart' ('file:///Users/macbook/Documents/flutter/packages/flutter/lib/src/painting/image_stream.dart').
Try changing the type of the parameter, or casting the argument to 'ImageStreamListener'.
return () => newStream.removeListener(listener);
^
Compiler failed on /Users/macbook/AndroidStudioProjects/alimmentation/lib/main.dart
Finished with error: Gradle task assembleDebug failed with exit code 1

最佳答案

通过替换解决了类似的问题

/*...*/.addListener((ImageInfo image, bool synchronousCall) { /*...*/ });

import 'package:flutter/painting.dart';

/*...*/.addListener(new ImageStreamListener((ImageInfo image, bool synchronousCall) { /*...*/ }) as ImageStreamListener);

关于升级后 Flutter 不再工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56401223/

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