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.
Extensions
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< typeData, TTypeMappers<String> >MapperEvent> mappers) → String -
buildObjectMapper(
String type, String fieldName, TTypeMappers< MapperEvent> mappers) → String? -
combinePathSets(
List< Set< pathSets) → Set<String> >String> -
Combines multiple
pathSetsinto 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
mappersfor mappers that match the giventypeand returns them. -
fixDartFile(
String filePath) → Future< ProcessOutcome> -
Applies
dart fix --applyto the Dart file atfilePath. -
fixRustFile(
String filePath) → Future< ProcessOutcome> -
Runs
cargo fixon the Cargo project that owns the file atfilePath. -
fixTsJsFile(
String filePath) → Future< ProcessOutcome> -
Fixes the TypeScript/JavaScript file at
filePathviaeslint --fix. -
fmtDartFile(
String filePath) → Future< ProcessOutcome> -
Formats the Dart file at
filePathviadart format. -
fmtRustFile(
String filePath) → Future< ProcessOutcome> -
Formats the Rust file at
filePathvia therustfmtcommand. -
fmtTsJsFile(
String filePath) → Future< ProcessOutcome> -
Formats the TypeScript/JavaScript file at
filePathviaprettier --write. -
isMatchingFileName(
String filePath, String begType, String endType) → ({String fileName, bool status}) -
Checks if the file name extracted from
filePathmatches the specified beginning typebegTypeand ending typeendType. -
isPrivateFileName(
String filePath) → bool -
Checks if the provided
filePathis a private file (starts with an underscore). -
matchesAnyExtension(
String filePath, Set< String> extensions, {bool caseSensitive = true}) → bool -
Checks if the provided
filePathmatches any of the specifiedextensions. -
matchesAnyPathPattern(
String path, Set< String> pathPatterns) → bool -
Checks if the provided
pathmatches any of the specifiedpathPatterns, 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
pathcontains any of the specifiedcomponents. 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 fromonAnnotCallbacksfor each annotation found. -
replaceData(
String input, Map< Pattern, dynamic> data) → String -
Replaces the keys of
dataininputwith the corresponding values. -
toUnixSystemPathFormat(
String path) → String -
Replaces all backslashes in
pathwith forward slashes. -
toWindowsSystemPathFormat(
String path) → String -
Replaces all forward slashes in
pathwith 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
keysuffixed with a short, stable hash of its Englishsourcetext.
Typedefs
- Glog = Log
-
TFileReaderFunction
= Future<
String> Function(String filePath) -
TGeneratorFn
= Future<
void> Function(List<String> args) -
TIntersection<
T> = Iterable< Intersection< T> > -
TLineCallback
= Future<
bool> Function(int lineNumber, List<String> lines, String filePath) - TOnAnnotatedClassCallback = Future Function(OnAnnotatedClassParams parent)
- TOnAnnotatedMemberCallback = Future Function(OnAnnotatedMemberParams parent)
- TOnAnnotatedMethodCallback = Future Function(OnAnnotatedMethodParams parent)
- TOnClassAnnotationFieldCallback = Future Function(OnClassAnnotationFieldParams parent)
- TOnMemberAnnotationFieldsCallback = Future Function(OnMemberAnnotationFieldParams parent)
- TOnMethodAnnotationFieldCallback = Future Function(OnMethodAnnotationFieldParams parent)
- TOnPostAnalysis = void Function(OnAnnotatedClassParams params)
- TOnPreAnalysis = void Function(String fullFilePath, String className)
-
TPathExplorerFindings
= Future<
({Set< DirPathExplorerFinding> dirPathFindings, Set<FilePathExplorerFinding> filePathFindings, Set<DirPathExplorerFinding> rootDirPathFindings})> - TranslationErrorSink = void Function(String source, Object error, StackTrace stack)
- Signature of the TranslationManager.onError sink.
-
TTypeMappers<
E extends MapperEvent> = Map< String, String Function(E event)>
Exceptions / Errors
- ConfigParseException
- Thrown when a configuration source cannot be parsed into a key-value map.