Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flutter_svg dependency build failed #351

Closed
Aoi-hosizora opened this issue Jul 11, 2020 · 10 comments
Closed

flutter_svg dependency build failed #351

Aoi-hosizora opened this issue Jul 11, 2020 · 10 comments

Comments

@Aoi-hosizora
Copy link

After I upgrade Flutter to 1.20.0-3.0.pre.142, my project builds failed (see logs). I find that flutter_svg 0.17.4 is depended by flutter_html 1.0.0. I have found an issue related to this problem: dnfield/flutter_svg#368, but it says to update flutter_svg to 0.18.0+. So how could I fix this problem?

Launching lib\main.dart on Google Nexus 5X Android 8 in debug mode...
/C:/Users/Windows%2010/AppData/Roaming/Pub/Cache/hosted/pub.flutter-io.cn/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26: Error: Type 'DiagnosticableMixin' not found.
class PictureStream with DiagnosticableMixin {
                         ^^^^^^^^^^^^^^^^^^^
/C:/Users/Windows%2010/AppData/Roaming/Pub/Cache/hosted/pub.flutter-io.cn/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:44: Error: Type 'DiagnosticableMixin' not found.
abstract class PictureStreamCompleter with DiagnosticableMixin {
                                           ^^^^^^^^^^^^^^^^^^^
/C:/Users/Windows%2010/AppData/Roaming/Pub/Cache/hosted/pub.flutter-io.cn/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:7: Error: The type 'DiagnosticableMixin' can't be mixed in.
class PictureStream with DiagnosticableMixin {
      ^
/C:/Users/Windows%2010/AppData/Roaming/Pub/Cache/hosted/pub.flutter-io.cn/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:16: Error: The type 'DiagnosticableMixin' can't be mixed in.
abstract class PictureStreamCompleter with DiagnosticableMixin {
               ^
/C:/Users/Windows%2010/AppData/Roaming/Pub/Cache/hosted/pub.flutter-io.cn/flutter_svg-0.17.4/lib/src/picture_stream.dart:167:11: Error: Superclass has no method named 'debugFillProperties'.
    super.debugFillProperties(properties);
          ^^^^^^^^^^^^^^^^^^^
/C:/Users/Windows%2010/AppData/Roaming/Pub/Cache/hosted/pub.flutter-io.cn/flutter_svg-0.17.4/lib/src/picture_stream.dart:171:30: Error: The method 'toStringShort' isn't defined for the class 'PictureStreamCompleter'.
 - 'PictureStreamCompleter' is from 'package:flutter_svg/src/picture_stream.dart' ('/C:/Users/Windows%2010/AppData/Roaming/Pub/Cache/hosted/pub.flutter-io.cn/flutter_svg-0.17.4/lib/src/picture_stream.dart').
Try correcting the name to the name of an existing method, or defining a method named 'toStringShort'.
      ifPresent: _completer?.toStringShort(),
                             ^^^^^^^^^^^^^
/C:/Users/Windows%2010/AppData/Roaming/Pub/Cache/hosted/pub.flutter-io.cn/flutter_svg-0.17.4/lib/src/picture_stream.dart:266:11: Error: Superclass has no method named 'debugFillProperties'.
    super.debugFillProperties(description);
          ^^^^^^^^^^^^^^^^^^^


FAILURE: Build failed with an exception.
@ueman
Copy link

ueman commented Jul 11, 2020

You can do a dependency override by specifying this in your pubspec:

dependency_overrides:
  flutter_svg: 0.18.0

It will get fixed when the next flutter stable gets released:

#332

@Aoi-hosizora
Copy link
Author

@ueman I see, now I have to use dependency_overrides and it works. So when next version is released, this will be fixed?

@baltejsingh88
Copy link

@Aoi-hosizora Hi, How did you resolve this issue? I am having the same issue. I tried adding dependency overrides but same issue. Can you share your pubsec?

@Aoi-hosizora
Copy link
Author

@sparkidea-codecrab Here is my pubspec.yaml, I override dependency version (although it logs warning) and it works.

dependencies:
  # ...
  flutter_html: ^1.0.0
  # ...
  
dependency_overrides:
  flutter_svg: 0.18.0

And here is my generated pubspec.lock:

  flutter_html:
    dependency: "direct main"
    description:
      name: flutter_html
      url: "https://pub.flutter-io.cn"
    source: hosted
    version: "1.0.0"


  flutter_svg:
    dependency: "direct overridden"
    description:
      name: flutter_svg
      url: "https://pub.flutter-io.cn"
    source: hosted
    version: "0.18.0"

@baltejsingh88
Copy link

@Aoi-hosizora Do I also have to add flutter_svg: ^0.17.4 on dependencies section?

@Aoi-hosizora
Copy link
Author

@sparkidea-codecrab No, flutter_html will dependent flutter_svg 0.17.4, and it will add to lock file automatically. So we have to override this version using dependency_overrides.

@baltejsingh88
Copy link

@Aoi-hosizora I just did the same, but not luck. Got this:
[learning_kart_app] flutter pub get
Running "flutter pub get" in learning_kart_app...
Because flutter_svg >=0.18.0 depends on xml ^4.1.0 and every version of flutter_test from sdk depends on xml 3.6.1, flutter_svg >=0.18.0 is incompatible with flutter_test from sdk.

So, because kart depends on both flutter_test any from sdk and flutter_svg 0.18.0, version solving failed.
pub get failed (1; So, because kart depends on both flutter_test any from sdk and flutter_svg 0.18.0, version solving failed.)
exit code 1

@baltejsingh88
Copy link

@Aoi-hosizora I resolved it.. thank you!

@Aoi-hosizora
Copy link
Author

I have solved this problem temporarily using dependency_overrides. So I just close this issue.

@garshom
Copy link

garshom commented Aug 4, 2020

Solved it by adding dependency_overides in pubspec.xml

dependency_overrides:
flutter_svg: 0.18.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants