DartFormatter constructor

DartFormatter({
  1. String? lineEnding,
  2. int? pageWidth,
  3. int? indent,
  4. Iterable<StyleFix>? fixes,
  5. List<String>? experimentFlags,
})

Creates a new formatter for Dart code.

If lineEnding is given, that will be used for any newlines in the output. Otherwise, the line separator will be inferred from the line endings in the source file.

If indent is given, that many levels of indentation will be prefixed before each resulting line in the output.

While formatting, also applies any of the given fixes.

Implementation

DartFormatter(
    {this.lineEnding,
    int? pageWidth,
    int? indent,
    Iterable<StyleFix>? fixes,
    List<String>? experimentFlags})
    : pageWidth = pageWidth ?? 80,
      indent = indent ?? 0,
      fixes = {...?fixes},
      experimentFlags = [...?experimentFlags];