Flutter: Found this candidate, but the arguments don't match
Asked Answered
S

13

37

I am working on a flutter app and project was running perfectly but suddenly project isn't running and it is giving me an error.

Here is the error code i am getting when i try to run app

Compiler message:
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/extended_image-0.7.2/lib/src/gesture/extended_image_slide_page_route.dart:333:9: Error: No named parameter with the name 'animation'.
        animation: animation,
        ^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/cupertino/route.dart:435:3: Context: Found this candidate, but the arguments don't match.
  CupertinoFullscreenDialogTransition({
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.15.0/lib/src/picture_stream.dart:92:3: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
  PictureStream();
  ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.15.0/lib/src/picture_stream.dart:192:16: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
abstract class PictureStreamCompleter extends Diagnosticable {
               ^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/extended_image-0.7.2/lib/src/gesture/extended_image_slide_page_route.dart:333:9: Error: No named parameter with the name 'animation'.
        animation: animation,                                           
        ^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/cupertino/route.dart:435:3: Context: Found this candidate, but the arguments don't match.
  CupertinoFullscreenDialogTransition({
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.15.0/lib/src/picture_stream.dart:92:3: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
  PictureStream();
  ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.15.0/lib/src/picture_stream.dart:192:16: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
abstract class PictureStreamCompleter extends Diagnosticable {
               ^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.                                                           

FAILURE: Build failed with an exception.
                                                                        

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\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.

BUILD FAILED in 43s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        44.9s
Exception: Gradle task assembleDebug failed with exit code 1
Stroke answered 3/4, 2020 at 13:27 Comment(2)
Hi Moaaz, please try to include a short description of are trying to do, what led to this error and what you had done to try to fix this error. Nobody knows how to help you if we only see a bunch of error logs. Do give this guide a read: How to ask.Surname
have you found the solution?Grosswardein
H
46

Try add in your pubsepc.yaml flutter_svg: ^0.17.3+1. For me works

Horodko answered 7/4, 2020 at 1:5 Comment(1)
Initially did work when i only just included this flutter_svg: ^0.17.3+1 file. But this worked for me too, after doing the running a "flutter clean" command, then included flutter_svg: ^0.17.3+1 in pubsepc.yaml followed by a "flutter pub get" (don't automatically by the flutter extension in my VSCode IDE) command.Dich
S
7

Use the latest version of your package (flutter_svg: ^0.18.0)

It works for me

Substitution answered 9/8, 2020 at 4:7 Comment(0)
L
5

First I ran this command

flutter clean

then I added the latest version to my pubspec.yaml file

flutter_svg: ^0.18.0

then I ran the the following command

flutter pub get

then I ran successfully

Lateral answered 20/8, 2020 at 17:3 Comment(0)
C
4

If you are using extended_image, you may be will need to update it, This is working with me:

extended_image: ^0.7.3-dev

Source

Condition answered 14/5, 2020 at 16:18 Comment(0)
D
1

Delete the version number and update the pubsepc.yaml file or Updated versions of the packages

Devastate answered 7/4, 2020 at 2:12 Comment(0)
M
1

This solution worked for me:

https://github.com/inspireui/support/issues/2740#issuecomment-614582990

I just shifted the channel to stable

Monday answered 16/4, 2020 at 13:43 Comment(1)
Thanks. I was encountering a similar error ../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26: Error: Type 'DiagnosticableMixin' not found. when running flutter run --flavor prod, which I resolved by installing the 'stable' branch of Flutter with git clone https://github.com/flutter/flutter.git -b stable (instead of the 'master' or 'beta' branch) and then executing it with cd flutter; ./flutter/bin/flutter run --flavor prodSalomesalomi
C
1

If you still getting error after upgrading package due to dependency of another package - just use the same version flutter_svg-0.15.0, because many of dependent packages are still not upgraded.

Go to you flutter SDK folder - flutter.pub-cache\hosted\pub.dartlang.org\flutter_svg-0.15.0\lib\src

Open picture_stream.dart file and put the below changes.

  1. abstract class PictureStreamCompleter extends Diagnosticable => abstract class PictureStreamCompleter with DiagnosticableMixin

  2. class PictureStream extends Diagnosticable => class PictureStream with DiagnosticableMixin

Above solution is based on this pull request of flutter.

To support both stable and beta channels, I'd suggest that this should be

class PictureStream with DiagnosticableMixin { ... } until DiagnosticableMixin is officially deprecated.

flutter/flutter#50498

then run pub get and run the project.

Above solution will work only if - flutter_svg is not in your current project but in your .pub_cache - so and dependent package you have used in your current project - so this will be solution until DiagnosticableMixin is officially deprecated.

Covington answered 11/5, 2020 at 4:40 Comment(0)
D
1

Try this:

Start by running a,

  1. "flutter clean" command, then included,
  2. flutter_svg: ^0.17.3+1 in pubsepc.yaml followed by a,
  3. "flutter pub get" command. Then run your code to see if you will still get this error. This was what worked for me
Dich answered 18/5, 2020 at 18:16 Comment(1)
Because fstore depends on koukicons 2.0.2 which depends on flutter_svg ^0.15.0, flutter_svg ^0.15.0 is required. So, because fstore depends on flutter_svg ^0.17.3+1, version solving failed.Covington
C
0

The animation parameter was split and renamed by github.com/flutter/flutter/pull/50180. Because there apparently are no existing tests that use CupertinoFullscreenDialogTransition, that change did not break any tests and was not deemed to be a breaking change.

I'm working on it how you can resolve this in your existing structure, I'll update you soon for same. Meanwhile just updating you that - It is renamed public API by the team.

Covington answered 8/4, 2020 at 4:49 Comment(1)
From the Error: No named parameter with the name 'animation'. error message, it's clear that the CupertinoFullscreenDialogTransition constructor parameters changed. From there I searched the flutter git repository for where CupertinoFullscreenDialogTransition is implemented, ran git blame to see what commit modified the parameter, and looked at its commit description to find the referenced pull request.Covington
S
0

I was using flame dependency flame: ^0.17.3 I changed it to the current flame: ^0.20.1 if you are using the flame dependency try that!

Siberson answered 7/5, 2020 at 23:3 Comment(0)
Y
0

Upgrade the flutter_svg to the latest version and check if any other package that depends on it doesn't give you any error. If you get another error about the flutter_svg then just comment that package and any other package that depend on flutter_svg and check again

Yancy answered 8/5, 2020 at 6:21 Comment(0)
L
0
  1. Upgrade flutter_svg to the latest version in pubsepc.yaml
  2. Then Run the following command in the terminal "flutter pub get"
Lebar answered 9/10, 2020 at 9:56 Comment(0)
A
0

This error may occur due to: flutter_svg, extended_image, wechat_assets_picker...

The solution is to upgrade these packages to the latest version.

Archaean answered 12/8, 2023 at 12:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.