flutter project isn't running - Compiler message

柔情痞子 提交于 2020-05-29 02:53:37

问题


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 {
               ^

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 {
               ^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.                                                           

FAILURE: Build failed with an exception.

* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882

* 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 43s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        44.9s
Exception: Gradle task assembleDebug failed with exit code 1

回答1:


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




回答2:


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




回答3:


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.




回答4:


This solution worked for me:

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

I just shifted the channel to stable




回答5:


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!




回答6:


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




回答7:


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.




回答8:


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




回答9:


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


来源:https://stackoverflow.com/questions/61012971/flutter-project-isnt-running-compiler-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!