Skip to content

required keyword on lambda suggestion #4834

@FMorschel

Description

@FMorschel

Is your feature request related to a problem? Please describe.
I have the following class in my Flutter project:

class DataRowCubit<T> extends Cubit<List<DataRow>> {
  DataRowCubit({
    required DataRow Function({
      required bool selected,
      required T data,
      required int index,
      // ignore: avoid_positional_boolean_parameters, single parameter
      required void Function(bool?) onSelectionChanged,
    }) dataRow,
    void Function({
      required bool? selection,
      required int index,
      required List<bool> list,
    })? onSelectionChanged,
    List<T>? list,
  })
//...

But when I write down the constructor to create a new instance, the suggested fillings for the lambdas are the following:

image

This creates a minor inconvenience that I then need to write down the requireds myself in all of the non-null parameters:

image

Describe the solution you'd like
I would like for the suggested code to follow the required keyword.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris enhancementrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions