dart-lang / sdk

The Dart SDK, including the VM, dart2js, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
9.98k stars 1.54k forks source link

Quick fixes for multiple required arguments could be more useful #49775

Open matanlurey opened 1 year ago

matanlurey commented 1 year ago
void example() {
  // https://dart.dev/tools/diagnostic-messages#missing_required_argument
  Listener();
}

class Listener {
  final void Function() onA;
  final void Function(String) onB;
  final void Function(String, String) onC;

  Listener({
    required this.onA,
    required this.onB,
    required this.onC,
  });
}

... produces the following quick-fixes:

I would have assumed Add all required arguments was an available quick fix, but it was not.

jonahwilliams commented 1 year ago

When dealing with a class with a lot of named parameters - like widgets, I find myself copying and pasting other instances of that widget and filling in the differences. As error prone as that is, it feels 10x faster than trying to correctly autocomplete and quickfix a new instance.