rrousselGit / functional_widget

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

Generating build_script fails in Flutter 1.12.13 #63

Closed xiaozhizhong closed 4 years ago

xiaozhizhong commented 4 years ago

I guess this issue is same with https://github.com/rrousselGit/functional_widget/issues/55#issue-502262720, but my sdk is stable channel v1.12.13+hotfix.8

try with: functional_widget_annotation: ^0.5.1 functional_widget: ^0.7.2

when i run the app, error occurs. the output is: `generating build script... 31.9s Exception: Error generating build_script snapshot: ../../../base/flutterSDK/flutter/.pub-cache/hosted/pub.flutter-io.cn/functional_widget-0.7.2/lib/function_to_widget_class.dart:216:43: Error: The getter 'isUndefined' isn't defined for the class 'DartType'.

juancastillo0 commented 4 years ago

I have the same problem and I'm using https://github.com/Milad-Akarie/auto_route_library/tree/master/auto_route_generator which requires analyzer ">=0.39.0".

analyzer changelog: https://github.com/dart-lang/sdk/blob/stable/pkg/analyzer/CHANGELOG.md

Is it the same as checking DartType.element == null?

abstract class DartType {
  /// Return the element representing the declaration of this type, or `null` if
  /// the type has not, or cannot, be associated with an element. The former
  /// case will occur if the element model is not yet complete; the latter case
  /// will occur if this object represents an undefined type.
  Element get element;
...
}

from analyzer 0.35.4:

/**
 * Return `true` if this type represents a typename that couldn't be resolved.
 */
bool get isUndefined;

In the codebase, the isUndefined method is only used from objects of ParameterElement.type.

rrousselGit commented 4 years ago

Sorry for the delay

Is it the same as checking DartType.element == null?

It doesn't seem so. The workaround to parse Color & co no longer works because of it. I'll have to investigate more about it

rrousselGit commented 4 years ago

Fixing it is non-trivial. I'm in the process of rewriting the package to fix that and add support for default/values

karianpour commented 4 years ago

I used a workaround which I wrote in the other related issue

truongsinh commented 4 years ago

See https://github.com/rrousselGit/functional_widget/issues/64#issuecomment-626050694