-
Notifications
You must be signed in to change notification settings - Fork 344
Closed
Labels
in editorRelates to code editing or language featuresRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serverSomething to be fixed in the Dart analysis serveris bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become availableSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
Milestone
Description
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):
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in editorRelates to code editing or language featuresRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serverSomething to be fixed in the Dart analysis serveris bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become availableSomething that requires changes in the Dart/Flutter SDK to ship before it will become available