dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.25k stars 1.58k forks source link

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

Open matanlurey opened 2 years ago

matanlurey commented 2 years 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.