insertConstructor abstract method

void insertConstructor(
  1. CompilationUnitMember container,
  2. void buildEdit(
    1. DartEditBuilder builder
    ), {
  3. bool isNamed = false,
})

Inserts the code for a constructor.

The constructor is inserted after the last existing field or constructor, or if the sort_constructors_first lint rule is enabled, after the last existing constructor, or if the sort_unnamed_constructors_first lint rule is enabled and isNamed is false, after the last existing unnamed constructor or field.

Throws an exception if container is not a CompilationUnitMember which can have constructor declarations.

Implementation

void insertConstructor(
  CompilationUnitMember container,
  void Function(DartEditBuilder builder) buildEdit, {
  bool isNamed = false,
});