functional_widget
functional_widget copied to clipboard
@cwidget not generating ConsumerWidget as expected
Describe the bug
updating @swidget to @cwidget to generate a ConsumerWidget instead of StatelessWidget.
The build_runner is not generating for me for some reason. It's still StatelessWidget. Try to delete the g.dart file still getting the same StatelessWidget.
flutter_riverpod: ^0.14.0+3
functional_widget_annotation: ^0.9.0
functional_widget: ^0.9.0+1
in my local. Not sure what am I missing
To Reproduce
part 'test_widget.g.dart';
@cwidget Widget testWidget(BuildContext context) { return Container() }
Expected behavior A clear and concise description of what you expected to happen.
I can confirm the bug. @cwidget is not working, in the the corresponding generated g.dart-file the created Widget inherits from Stateless Widget instead of ConsumerWidget. Thus, there is trouble finding the _ref argument in the build method.
Just to add that for me, no matter what annotation, build runner always generates a Stateless Widget.
functional_widget_annotation: ^0.10.0
functional_widget: ^0.10.0
I had a dependency of freezed package. When I updated it to the latest version, it solves my issue.