Describe the bug
Before:
class ValueButton<T extends Enum> extends StatefulWidget { final String label; final T value; final void Function(T?) onChanged; const ValueButton( {required this.label, required this.value, required this.onChanged, super.key}); @override State<ValueButton> createState() => _ValueButtonState(); } class _ValueButtonState<T extends Enum> extends State<ValueButton<T>> { @override Widget build(BuildContext context) { return ElevatedButton( onPressed: () => widget.onChanged(widget.value), child: Text(widget.label)); } }
After "Convert to StatelessWidget":
class ValueButton<T extends Enum> extends StatelessWidget { final String label; final T value; final void Function(T?) onChanged; const ValueButton( {required this.label, required this.value, required this.onChanged, super.key}); @override Widget build(BuildContext context) { return ElevatedButton( onPressed: () => widget.onChanged(value), // ***** `widget.` was not removed from `onChanged` child: Text(label)); } }
widget.value and widget.label correctly had widget. removed, but widget.onChanged was not correctly changed to onChanged.
Please complete the following information:
- Operating System and version: Linux fedora 6.3.6-200.fc38.x86_64
- VS Code version: 1.79.2
- Dart extension version: 3.66.0
- Dart/Flutter SDK version: 3.0.5
- Target device (if the issue relates to Flutter debugging):