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

32,884

Solution 1

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

Solution 2

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

It works for me

Solution 3

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

Solution 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

Solution 5

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.

Share:
32,884
Moaaz Mezo
Author by

Moaaz Mezo

Updated on January 27, 2021

Comments

  • Moaaz Mezo
    Moaaz Mezo over 3 years

    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