Repository navigation
Error: The argument type 'String' can't be assigned to the parameter type 'DiagnosticsNode'. - 'DiagnosticsNode' is from #31962
Copy link
Copy link
Closed
Labels
c: API breakBackwards-incompatible API changesBackwards-incompatible API changesc: crashStack traces logged to the consoleStack traces logged to the consolecustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.p: firebaseObsolete - Firebase pluginsObsolete - Firebase pluginsp: firebase_crashlyticsObsolete - The Firebase Crashlytics pluginObsolete - The Firebase Crashlytics pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.
Description
After upgrading to 1.5.9-pre.108 I seem to be getting this issue with 3 packages I use, should I take this up with the packages or is it something that you guys will fix?
Pacakges affected in my project:
multi_image_picker: ^4.2.0
flutter_sticky_header: ^0.3.4
cached_network_image: ^0.7.0
Steps to Reproduce
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_sticky_header/flutter_sticky_header.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
home: Page1(),
);
}
}
class Page1 extends StatelessWidget {
final String title;
const Page1({Key key, this.title = "Page 1"}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
),
body: CustomScrollView(
slivers: <Widget>[
SliverStickyHeader(
header: Text('Users'),
sliver: SliverList(
delegate: SliverChildBuilderDelegate(
(context, i) => Text(i.toString()),
),
),
),
],
));
}
}
Added pubspec dependency
flutter_sticky_header: ^0.3.4
attempt to build the project.
Logs
Compiler message:
file:///Users/calvinmuller/.pub-cache/hosted/pub.dartlang.org/flutter_sticky_header-0.3.4/lib/src/widgets/sticky_header_layout_builder.dart:147: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:///Users/calvinmuller/iStreet/Mobile/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: context);
^
Compiler failed on /Users/calvinmuller/iStreet/Mobile/testwhite/lib/main.dart
Error launching application on iPhone X.
Compiler message:
file:///Users/calvinmuller/.pub-cache/hosted/pub.dartlang.org/cached_network_image-0.7.0/lib/src/cached_network_image_provider.dart:46: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:///Users/calvinmuller/iStreet/Mobile/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:///Users/calvinmuller/.pub-cache/hosted/pub.dartlang.org/multi_image_picker-4.2.0/lib/src/asset_thumb_provider.dart:35: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:///Users/calvinmuller/iStreet/Mobile/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) {
[✓] Flutter (Channel master, v1.5.9-pre.108, on Mac OS X 10.14.4 18E226, locale en-ZA)
• Flutter version 1.5.9-pre.108 at /Users/calvinmuller/iStreet/Mobile/flutter
• Framework revision 15f187fce0 (89 minutes ago), 2019-05-01 20:39:37 -0700
• Engine revision ce9e9ba7e4
• Dart version 2.3.0 (build 2.3.0-dev.0.5 b6997deb3e)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
c: API breakBackwards-incompatible API changesBackwards-incompatible API changesc: crashStack traces logged to the consoleStack traces logged to the consolecustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.p: firebaseObsolete - Firebase pluginsObsolete - Firebase pluginsp: firebase_crashlyticsObsolete - The Firebase Crashlytics pluginObsolete - The Firebase Crashlytics pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.
Activity
Zazo032 commentedon May 2, 2019
This might be related to Dart 2.3.0 version bump, here you can find a temporary workaround for
cached_network_image(should also work for the other 2 packages): Baseflow/flutter_cached_network_image#171 (comment)calvinmuller commentedon May 2, 2019
it feels sooo wrong - but for now it will have to do, given i've been building against master its way to difficult to go back now!
Thanks!
vijayawoshe commentedon May 2, 2019
For me 4 to 5 Plugins are failing
1.sentry
2. flutter_advanced_networkimage
3.cached_network_image_provider
4. fllushbar
5. flutter_svg etc
with the same errors.
This issue has to be solved asap.
Thanks
thanhhuan1990 commentedon May 2, 2019
I have gotting the same errors with 2 libs with same issue.
This issue should be solved asap.
Thanks
mklim commentedon May 2, 2019
The root cause is #30983. The change to
contextthere is breaking. I think it should probably be reverted and relanded in a more gradual migration instead of an in-place breaking change? This also breaksfirebase_crashlytics, which passescontextover theMethodChanneldirectly under the asusmption that it's a String.flutter/pluginsCI is currently red based on this./cc @jacob314 @kroikie
mklim commentedon May 3, 2019
My mistake, the breaking change was intentional. https://groups.google.com/forum/#!topic/flutter-announce/hp1RNIgej38 #27327
This is unfortunately a difficult breaking change for plugins authors to deal with, since plugins users could be using
stable(in which this is a String) ormaster, in which this is aDiagnosticsNode. Just migrating to the latest version will break users on older versions of Flutter.I think plugins authors can work around this without breaking either new or old versions of Flutter for now by type checking and handling the property differently depending on what it is. That's not an ideal fix though.
jacob314 commentedon May 3, 2019
We can change the type of context from
DiagnosticsNodeto Object for a few months to allow for a gradual migration.Based on analysis of all pub packages this change should break about 13 packages. I am happy to help anyone who needs to migrate their package to migrate it.
jacob314 commentedon May 3, 2019
flutter_svg has been fixed. Let me know if you are still having issues with it.
56 remaining items
gondaimgano commentedon Jul 24, 2019
Guys I am completely stuck after upgrading to the 1.7.8+hotfix.3 I have been unable to compile in iOS. I have tried downgrading back to 1.5 but the error is still there. I have tried creating a new project and just once it managed to compile to the simulator. After that its been giving me nightmares. Please please. When is this issue going to be resolved. We are dealing with tight timelines for my clients projects. I am now at an advanced stage of the project. Please I need a resolution to this. This is severe.
samfrank commentedon Jul 29, 2019
My fix for this was to update the flutter_svg to
0.13.0CarrieUp commentedon Aug 3, 2019
Same issue for Flutter 1.7.8+hotfix.4
even I upgrade flutter_image to ^2.0.0 and flutter_image_compress to ^0.4.0
Compiler message:
file:///T:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_image_compress-0.4.0/lib/flutter_image_compress.dart:188:16: Error: The argument type 'String' can't be assigned to the parameter type 'DiagnosticsNode'.
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: 'image load failed ',
^
file:///T:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_image_compress-0.4.0/lib/flutter_image_compress.dart:196:32: Error: No named parameter with the name 'onError'.
stream.addListener(listener, onError: errorListener);
^^^^^^^
file:///T:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_image_compress-0.4.0/lib/flutter_image_compress.dart:198:27: Error: The argument type 'void Function(ImageInfo, bool)' can't be assigned to the parameter type 'ImageStreamListener'.
Try changing the type of the parameter, or casting the argument to 'ImageStreamListener'.
stream.removeListener(listener);
^
Compiler terminated unexpectedly.
FAILURE: Build failed with an exception.
Where:
Script 'T:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 638
What went wrong:
Execution failed for task ':app:compileflutterBuildStagingReleaseArm'.
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 24s
Running Gradle task 'assembleStagingRelease'...
Running Gradle task 'assembleStagingRelease'... Done 25.9s
Gradle task assembleStagingRelease failed with exit code 1
tvolkert commentedon Aug 3, 2019
@CarrieUp have you tried updating your dependency on
flutter_image_compress? It looks like it's up to version0.6.3, and you're using0.4.0.CarrieUp commentedon Aug 4, 2019
@tvolkert thank you so much, I solve the problem by your suggestion: upgrading dependency on flutter_image_compress version to 0.6.3
kawynsean commentedon Aug 10, 2019
Running into the same issue as well. Looks like I just need to update my dependencies. New to this so thanks for any help!
Compiler message:
Compiler message:
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.2.1+1/lib/src/config.dart:4:31: Error: Type 'core.Config' not found.
abstract class Config extends core.Config {
^^^^^^^^^^^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.2.1+1/lib/src/widget_factory.dart:19:14: Error: Type 'core.Config' not found.
set config(core.Config config) {
^^^^^^^^^^^
file:///Users/kawynfurstoss/code/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'.
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: 'picture failed to precache',
^
file:///Users/kawynfurstoss/code/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'.
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: 'while resolving a picture',
^
file:///Users/kawynfurstoss/code/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 Function()'.
Try changing the type of the parameter, or casting the argument to 'Iterable Function()'.
informationCollector: (StringBuffer information) {
^
file:///Users/kawynfurstoss/code/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 Function()'.
Try changing the type of the parameter, or casting the argument to 'Iterable Function()'.
informationCollector: (StringBuffer information) {
^
file:///Users/kawynfurstoss/code/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 Function()'.
Try changing the type of the parameter, or casting the argument to 'Iterable Function()'.
informationCollector: (StringBuffer information) {
^
file:///Users/kawynfurstoss/code/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 Function()'.
Try changing the type of the parameter, or casting the argument to 'Iterable Function()'.
informationCollector: (StringBuffer information) {
^
file:///Users/kawynfurstoss/code/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'.
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: context,
^
file:///Users/kawynfurstoss/code/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'.
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: 'resolving a single-frame picture stream',
^
file:///Users/kawynfurstoss/code/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 Function()'.
Try changing the type of the parameter, or casting the argument to 'Iterable Function()'.
informationCollector: (StringBuffer buff) {
^
file:///Users/kawynfurstoss/code/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'.
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: 'in _Element.clipPath',
^
file:///Users/kawynfurstoss/code/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 Function()'.
Try changing the type of the parameter, or casting the argument to 'Iterable Function()'.
informationCollector: (StringBuffer buff) {
^
file:///Users/kawynfurstoss/code/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'.
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: 'in parseSvgElement',
^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_advanced_networkimage-0.4.15/lib/src/flutter_advanced_networkimage.dart:149:29: Error: The
argument type 'Null Function(StringBuffer)' can't be assigned to the parameter type 'Iterable Function()'.
Try changing the type of the parameter, or casting the argument to 'Iterable Function()'.
informationCollector: (StringBuffer information) {
^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_advanced_networkimage-0.4.15/lib/src/flutter_advanced_networksvg.dart:106:29: Error: The argument
type 'Null Function(StringBuffer)' can't be assigned to the parameter type 'Iterable Function()'.
Try changing the type of the parameter, or casting the argument to 'Iterable Function()'.
informationCollector: (StringBuffer information) {
^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flare_flutter-1.5.3/lib/flare.dart:1028:18: Error: The argument type 'Int32List' can't be assigned to the
parameter type 'Uint16List'.
Try changing the type of the parameter, or casting the argument to 'Uint16List'.
indices: _indices, textureCoordinates: _uvBuffer);
^
file:///Users/kawynfurstoss/code/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'.
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
context: 'in $methodName',
^
file:///Users/kawynfurstoss/code/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 Function()'.
Try changing the type of the parameter, or casting the argument to 'Iterable Function()'.
informationCollector: (StringBuffer buff) {
^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.2.1+1/lib/src/html_widget.dart:39:11: Error: No named parameter with the name
'wf'.
wf: wf,
^^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.2.1+1/lib/src/html_widget.dart:54:13: Error: Getter not found: 'wf'.
return (wf ?? extended.WidgetFactory())..config = this;
^^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.2.1+1/lib/src/html_widget.dart:54:13: Error: The getter 'wf' isn't defined for
the class 'HtmlWidget'.
('file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.2.1+1/lib/src/html_widget.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'wf'.
return (wf ?? extended.WidgetFactory())..config = this;
^^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.2.1+1/lib/src/widget_factory.dart:19:19: Error: 'Config' isn't a type.
set config(core.Config config) {
^^^^^^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.2.1+1/lib/src/widget_factory.dart:20:11: Error: Superclass has no setter named
'config'.
super.config = config;
^^^^^^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.2.1+1/lib/src/widget_factory.dart:36:21: Error: The getter 'onTapUrl' isn't
defined for the class 'Config'.
('file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.2.1+1/lib/src/config.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'onTapUrl'.
() => _config.onTapUrl != null
^^^^^^^^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.2.1+1/lib/src/widget_factory.dart:37:21: Error: The method 'onTapUrl' isn't
defined for the class 'Config'.
('file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.2.1+1/lib/src/config.dart').
Try correcting the name to the name of an existing method, or defining a method named 'onTapUrl'.
? _config.onTapUrl(url)
^^^^^^^^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_advanced_networkimage-0.4.15/lib/src/transition_to_image.dart:254:33: Error: The argument type
'void Function(ImageInfo, bool)' can't be assigned to the parameter type 'ImageStreamListener'.
Try changing the type of the parameter, or casting the argument to 'ImageStreamListener'.
_imageStream.removeListener(_updateImage);
^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_advanced_networkimage-0.4.15/lib/src/transition_to_image.dart:303:49: Error: The argument type
'void Function(ImageInfo, bool)' can't be assigned to the parameter type 'ImageStreamListener'.
Try changing the type of the parameter, or casting the argument to 'ImageStreamListener'.
return oldImageStream?.removeListener(_updateImage);
^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_advanced_networkimage-0.4.15/lib/src/transition_to_image.dart:325:38: Error: The argument type
'void Function(ImageInfo, bool)' can't be assigned to the parameter type 'ImageStreamListener'.
Try changing the type of the parameter, or casting the argument to 'ImageStreamListener'.
oldImageStream?.removeListener(_updateImage);
^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_advanced_networkimage-0.4.15/lib/src/transition_to_image.dart:326:46: Error: No named parameter
with the name 'onError'.
_imageStream.addListener(_updateImage, onError: _catchBadImage);
^^^^^^^
file:///Users/kawynfurstoss/code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.2.1+1/lib/src/widget_factory.dart:13:7: Error: The superclass, 'WidgetFactory',
has no unnamed constructor that takes no arguments.
class WidgetFactory extends core.WidgetFactory {
^
tvolkert commentedon Aug 12, 2019
@kawynsean your problem is originating from
package:flutter_widget_from_html- I'd start by trying to update your dependency on that package.christophe-oliveira commentedon Sep 26, 2019
Yes.... This was all I needed!
Thanks @samfrank!
kroikie commentedon Oct 13, 2019
@calvinmuller
This issue has been moved to firebase/flutterfire#385. Any further collaboration will be done there.
Update flutter_image per recent changes to framework (flutter#15)
flutterq commentedon May 18, 2021
github-actions commentedon Jul 30, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.