rrousselGit / functional_widget

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

Cannot run "flutter pub pub run build_runner watch" on Flutter dev channel #64

Closed PavelPZ closed 4 years ago

PavelPZ commented 4 years ago

I am using functional_widget for a long time (on both dev and master flutter dev channels).

After upgrading flutter dev channel last week, functional_widget-0.7.2 stops working (0.7.1 works well):

flutter pub pub run build_runner watch
[INFO] Generating build script...
[INFO] Generating build script completed, took 604ms

[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 7.5s

[SEVERE] Failed to snapshot build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.
[SEVERE] /C:/Users/pzika/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/functional_widget-0.7.2/lib/function_to_widget_class.dart:216:43: Error: The getter 'isUndefined' isn't defined for the class 'DartType'. - 'DartType' is from 'package:analyzer/dart/element/type.dart' ('/C:/Users/pzika/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.4/lib/dart/element/type.dart').Try correcting the name to the name of an existing getter, or defining a getter or field named 'isUndefined'.      'DiagnosticsProperty<${element.type.isUndefined ? findBeginToken(element) : element.type.displayName}>';                                          ^^^^^^^^^^^/C:/Users/pzika/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/functional_widget-0.7.2/lib/src/parameters.dart:57:20: Error: The gettePS 

C:\wikibulary\dart\know_how> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel dev, v1.15.3, on Microsoft Windows [Version 10.0.18362.657], locale cs-CZ)
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    X No Java Development Kit (JDK) found; You must have the environment variable JAVA_HOME set and the java
      binary in your PATH. You can download the JDK from
      https://www.oracle.com/technetwork/java/javase/downloads/.
[√] Chrome - develop for the web
[!] Android Studio (version 3.5)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    X Unable to determine bundled Java version.
[√] VS Code (version 1.42.1)
[√] Connected device (2 available)

! Doctor found issues in 2 categories.
PS C:\wikibulary\dart\know_how>
karianpour commented 4 years ago

It is caused by the following line:

https://github.com/rrousselGit/functional_widget/blob/126922d259bc3f7ee18c98806b188f5eaa7ae72a/functional_widget/lib/function_to_widget_class.dart#L216

element.type.isUndefined is removed from analyzer 0.37.

I am looking for a workaround by overriding the dependencies.

karianpour commented 4 years ago

I used a workaround as follow and it worked for me:

dependencies:
  flutter_hooks: ^0.7.0
  functional_widget_annotation: ^0.5.1

dev_dependencies:
  functional_widget: ^0.7.1
  build_runner: ^1.7.3

dependency_overrides:
  analyzer: 0.36.4
  source_gen: 0.9.4+2
danielmahon commented 4 years ago

The workaround isn't working for me. Can't seem to find an acceptable combination to get functional_widget and flutter_hooks to work on the flutter beta channel

truongsinh commented 4 years ago

FYI, this problem has escalated to stable channel of Flutter (1.17)

rrousselGit commented 4 years ago

I have another priority for the week

Then I'm full time on this + hooks issues

truongsinh commented 4 years ago

I'm looking into this tos see whether I can make a PR

truongsinh commented 4 years ago

ok, anyone want to try out my PR before @rrousselGit review my code, use this dependency declaration:

  functional_widget:
    git:
      url: git://github.com/truongsinh/functional_widget.git
      path: functional_widget
      ref: upgrade