rrousselGit / functional_widget

A code generator to write widgets as function without loosing the benefits of classes.
597 stars 46 forks source link

Version conflict due to build_config #72

Closed alekseikurnosenko closed 4 years ago

alekseikurnosenko commented 4 years ago

Hello, I am trying to start using this library, but keep getting the following error:

generating build script...
Because build_runner >=1.6.5 <1.7.4 depends on build_config >=0.4.1 <0.4.2 and functional_widget >=0.7.3 depends on build_config ^0.4.2, build_runner >=1.6.5 <1.7.4 is incompatible with functional_widget >=0.7.3.
So, because flutter_tool depends on both functional_widget ^0.7.3 and build_runner 1.7.1, version solving failed.
generating build script...                                          2.0s
Exception: pub get failed (1; So, because flutter_tool depends on both functional_widget ^0.7.3 and build_runner 1.7.1, version solving failed.)
Exited (1)

It seems that some dependency of flutter_tool pulls a fixed version of build_runner, which depends on an old build_config version.

Here is my pubspec.yaml:

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  google_maps_flutter: ^0.5.28+1
  functional_widget_annotation: ^0.5.1
  geolocator: ^5.3.2+2
  rxdart: ^0.24.1
  flutter:
    sdk: flutter
  openapi:
    path: gen

builders:
  functional_widget: ^0.7.3

I am using latest stable version of Flutter:

Flutter 1.17.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8af6b2f038 (5 days ago) • 2020-06-30 12:53:55 -0700
Engine • revision ee76268252
Tools • Dart 2.8.4

What I have already tried:

  1. Using dependency_override for build_runner or build_config - doesn't seem work.
  2. Using master branch of Flutter SDK - same behavior.
  3. Adding build_runner: 1.9.0 to flutter_tool - breaks the package.

Any ideas how to make it work?

rrousselGit commented 4 years ago

Adding build_runner: 1.9.0 to flutter_tool - breaks the package.

What do you mean by this?

alekseikurnosenko commented 4 years ago

Adding build_runner: 1.9.0 to flutter_tool - breaks the package. What do you mean by this?

I tried to patch Flutter SDK, by adding build_runner: 1.9.0 to flutter_tools pubspec. (The one in flutter_sdk/packages/flutter_tools). When I did that though, it failed to build the package due to compilation errors. (Due to public API changes)

alekseikurnosenko commented 4 years ago

Just in case, here is a reproducible sample: https://github.com/lekz112/functional_widget_sample

I did the following:

  1. Create a new flutter project.
  2. Add dependency to pubspec.
  3. Add a function annotated with @widget.
  4. Try to build.
  5. Observe an error.
rrousselGit commented 4 years ago

Raise an issue on Flutter's repository for them to support the latest version of build_runner.

Functional_widget can't do anything.

Alternatively use de_dependencies instead of builders:

alekseikurnosenko commented 4 years ago

After some investigation I found the the problem was that flutter_tools is hard-coding required versions of build_runner and build_daemon. While the version of build_runner was updated to 1.10.0 (Available on dev channel), the build_daemon is still very old and also breaks. (https://github.com/flutter/flutter/commit/e88ef6d554685812e59a85cde283e59df2b72c25#diff-5038cd916608b4b30824bf5b57d36959R27)

Since the manual way works normally, I'll just stick to it instead.