TidyConfig class

Resolved configuration for a tidy_imports run.

Configuration is read from tidy_imports.yaml at the project root if it exists (issue import_sorter#67), otherwise from the tidy_imports: block in pubspec.yaml. Command-line flags take precedence over both.

Constructors

TidyConfig({required bool emojis, required bool noComments, required bool noBlankLines, required bool sortPubspec, required bool groupProjectByFolder, required List<String> ignoredFiles, required List<CustomTier> customTiers, bool separateRelativeImports = false, bool testImports = false, List<String> testImportPrefixes = defaultTestImportPrefixes, bool sortExports = false, int groupProjectByFolderDepth = 0, bool removeDuplicates = false, bool removeUnused = false})
const
TidyConfig.fromYaml(dynamic config)
Builds a config from a parsed YAML node, applying defaults for anything missing. A null node yields all defaults.
factory
TidyConfig.load(String currentPath, YamlMap pubspecYaml)
Loads configuration, preferring tidy_imports.yaml over the tidy_imports: block in pubspec.yaml.
factory

Properties

customTiers List<CustomTier>
final
emojis bool
final
groupProjectByFolder bool
final
groupProjectByFolderDepth int
How many folder segments — counted after the package root — the project group is broken up by. 0 keeps the whole path, which is the original behaviour of groupProjectByFolder. Any value above 0 also switches that grouping on, since setting a depth is asking for it.
final
hashCode int
The hash code for this object.
no setterinherited
ignoredFiles List<String>
final
noBlankLines bool
final
noComments bool
final
removeDuplicates bool
Whether a directive written identically twice is folded into one. Opt-in: removing a line is not something a sorter should do uninvited.
final
removeUnused bool
Whether dart fix --apply --code=unused_import runs before sorting. Opt-in for the same reason, and because it costs an analyzer pass.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
separateRelativeImports bool
final
sortExports bool
Whether export directives are sorted into their own block. Opt-in: on by default it would rewrite the barrel file of every existing project.
final
sortPubspec bool
final
testImportPrefixes List<String>
final
testImports bool
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

defaultTestImportPrefixes → const List<String>
File-name prefixes treated as test doubles when testImports is on.