df_gen_core library

A package that provides core utilities for practical code generation.

Classes

AnalysisContextCollection
A collection of analysis contexts.
AnsiStyle
A class that provides a way to style strings with ANSI escape codes.
BootAudit
Persistent boot audit trail. Survives across app restarts (web reloads, PWA cold starts, native process restarts when backed by appropriate storage). The only thing that clears it is an explicit clear call.
BootAuditStorage
Synchronous key/value backend used by BootAudit to persist its trail across app boots.
CategorizedPattern<T>
ClassInsight<TAnnotation>
CliParser
CollectionMapperEvent
Mapper event for collection types, e.g. Map, List, Set.
Config<TConfigRef extends ConfigRef>
A configuration class that maps placeholder strings to values.
ConfigFileRef
A reference to a config file.
ConfigManager<TConfig extends Config<ConfigRef>>
In-memory registry of Config instances, keyed by their ConfigRef.
ConfigRef<TRef, TType>
A reference to a config element.
DartAnnotatedClassAnalyzer
Provides a mechanism to analyze Dart classes from a file path.
DirInsight
DirPathExplorerFinding
FileConfig
FileConfigManager
A ConfigManager specialised for FileConfig instances.
FileData
FileInsight
FilePathExplorerFinding
FileReadFinding
FileSystemUtility
Flag
GetPathCombinations
InMemoryBootAuditStorage
Process-local BootAuditStorage. Values live in a Map for the lifetime of the isolate and are lost on restart, which defeats the point of a boot audit trail — but it's the right default for tests and for non-web platforms where no persistent backend is wired yet.
InsightMapper<TInsight, TPlaceholder>
Intersection<TInsight>
LocalStorageBootAuditStorage
Non-web stub. Native and server platforms have no localStorage, so the audit trail is a no-op there. Use InMemoryBootAuditStorage (or supply a custom backend) when running outside the browser and you still want a trail.
Log
LogItem
MapperEvent
Mapper event base class.
MdTemplateUtility
MultiOptionParam
ObjectMapperEvent
Mapper event for non-collection types, e.g. int, String, DateTime.
OnAnnotatedClassParams
Params for TOnAnnotatedClassCallback.
OnAnnotatedMemberParams
Params for TOnAnnotatedMemberCallback.
OnAnnotatedMethodParams
Params for TOnAnnotatedMethodCallback.
OnClassAnnotationFieldParams
Params for TOnClassAnnotationFieldCallback.
OnMemberAnnotationFieldParams
Params for TOnMemberAnnotationFieldsCallback.
OnMethodAnnotationFieldParams
Params for TOnMethodAnnotationFieldCallback.
OptionParam
Param
PathExplorer
A mechanism to explore files and folders from specified combinations.
PathExplorerFinding
PathUtility
PatternSettings
How df_config recognises a placeholder in a string.
PerFileIntersection<T>
PerFileListIntersection<T>
PerFolderIntersection<T>
PerFolderListIntersection<T>
PerIntersection<T>
PrimaryPatternSettings
Deprecated alias for PatternSettings.primary.
ProcessOutcome
Result of invoking an external tool (formatter, linter, etc.) via Process.run.
ReplacementProducer<TInsight, TPlaceholder extends Enum>
SecondaryPatternSettings
Deprecated alias for PatternSettings.secondary.
Spinner
TemplateInterpolator<T>
TranslationFileReader
Convenience for loading translation files from disk or asset bundles.
TranslationManager
Process-wide owner of the active translation FileConfig that String.tr() looks up against.
TypeMappers

Enums

ConfigFileType
The supported config file types.
DefaultFlags
DefaultMultiOptions
DefaultOptionParams
ExitCodes
Represents standardized and custom exit codes for an application.
Lang
An enumeration of commonly used languages.

Constants

kTranslationVersionSeparator → const String
Separates a translation key from the source-text version hash in a versioned storage key, e.g. welcome_key@@a1b2c3d4e5f60718.

Functions

buildCollectionMapper(Iterable<List<String>> typeData, TTypeMappers<MapperEvent> mappers) → String
buildObjectMapper(String type, String fieldName, TTypeMappers<MapperEvent> mappers) → String?
combinePathSets(List<Set<String>> pathSets) → Set<String>
Combines multiple pathSets into a single set, returning all possible combinations.
createDartAnalysisContextCollection(Iterable<String> paths, String? fallbackDartSdkPath) → AnalysisContextCollection
Creates an AnalysisContextCollection from a set of paths. This is used to analyze Dart files.
exit(int code) → Never
Exit the Dart VM process immediately with the given exit code.
filterMappersByType(TTypeMappers<MapperEvent> mappers, String type) → TTypeMappers<MapperEvent>
Searches mappers for mappers that match the given type and returns them.
fixDartFile(String filePath) → Future<ProcessOutcome>
Applies dart fix --apply to the Dart file at filePath.
fixRustFile(String filePath) → Future<ProcessOutcome>
Runs cargo fix on the Cargo project that owns the file at filePath.
fixTsJsFile(String filePath) → Future<ProcessOutcome>
Fixes the TypeScript/JavaScript file at filePath via eslint --fix.
fmtDartFile(String filePath) → Future<ProcessOutcome>
Formats the Dart file at filePath via dart format.
fmtRustFile(String filePath) → Future<ProcessOutcome>
Formats the Rust file at filePath via the rustfmt command.
fmtTsJsFile(String filePath) → Future<ProcessOutcome>
Formats the TypeScript/JavaScript file at filePath via prettier --write.
isMatchingFileName(String filePath, String begType, String endType) → ({String fileName, bool status})
Checks if the file name extracted from filePath matches the specified beginning type begType and ending type endType.
isPrivateFileName(String filePath) → bool
Checks if the provided filePath is a private file (starts with an underscore).
matchesAnyExtension(String filePath, Set<String> extensions, {bool caseSensitive = true}) → bool
Checks if the provided filePath matches any of the specified extensions.
matchesAnyPathPattern(String path, Set<String> pathPatterns) → bool
Checks if the provided path matches any of the specified pathPatterns, which are regular expressions.
newTypeMap<T extends MapperEvent>(Map<String, String Function(T)> src) → TTypeMappers<T>
pathContainsComponent(String path, Set<String> components) → bool
Checks if the provided path contains any of the specified components. This operation is case-insensitive.
previewPath(String path) → String
Takes the last 3 segments of the path.
processCommentAnnots({required String filePath, required Map<String, TLineCallback> onAnnotCallbacks, required Set<String> annotsToDelete, String ignorePattern = r'[@_\s]', String commentAnnotPattern = r'^///?\s*@?([\w ]+)$'}) → Future<void>
Processes comment annotations in the file at filePath, invoking the appropriate callbacks from onAnnotCallbacks for each annotation found.
replaceData(String input, Map<Pattern, dynamic> data) → String
Replaces the keys of data in input with the corresponding values.
toUnixSystemPathFormat(String path) → String
Replaces all backslashes in path with forward slashes.
toWindowsSystemPathFormat(String path) → String
Replaces all forward slashes in path with backslashes.
translationSourceHash(String source) → String
A short, stable, platform-independent hash of source, rendered as 16 hex characters.
versionedTranslationKey(String key, String source) → String
Builds a content-addressed storage key for a translation entry: the plain key suffixed with a short, stable hash of its English source text.

Exceptions / Errors

ConfigParseException
Thrown when a configuration source cannot be parsed into a key-value map.