analytica library

Core infrastructure and shared utilities for the Analytica tooling ecosystem.

Classes

ExitCode
Exit code constants.

Extensions

AnalyticaArgParserExtensions on ArgParser
Standard CLI argument parsing options and helpers across Analytica tools.

Properties

dartExecutable String
Throwing getter that returns the absolute path to the dart binary.
no setter
flutterExecutable String
Throwing getter that returns the absolute or command path to flutter.
no setter
sdkPath String
Throwing getter that locates a Dart SDK root using findSdkPath.
no setter

Functions

appendGitHubStepSummary(String markdown, {File? summaryFile, StringSink? errSink}) → void
Appends markdown content to the GitHub Actions step summary file.
emitGitHubError(String message, {String? file, int? line, int? endLine, int? col, int? endColumn, String? title, StringSink? sink}) → void
Emits a GitHub Actions workflow error annotation.
emitGitHubNotice(String message, {String? file, int? line, int? endLine, int? col, int? endColumn, String? title, StringSink? sink}) → void
Emits a GitHub Actions workflow notice annotation.
emitGitHubWarning(String message, {String? file, int? line, int? endLine, int? col, int? endColumn, String? title, StringSink? sink}) → void
Emits a GitHub Actions workflow warning annotation.
findDartExecutable({String? sdkPath}) String?
Returns the absolute path to the dart executable inside the discovered SDK, or null if no valid SDK/binary is found.
findFlutterExecutable({String? flutterRoot}) String?
Locates the flutter CLI executable, probing FLUTTER_ROOT, PATH, and standard Flutter checkout directories.
findSdkPath() String?
Locates a Dart SDK root, probing in order: the running VM's executable, the DART_SDK environment variable, dart binaries on PATH (including Flutter checkouts, whose wrapper script hides the SDK under bin/cache/dart-sdk), FLUTTER_ROOT, and standard system SDK locations.
hasEnclosingPackageConfig(String packagePath) bool
Whether packagePath or any ancestor directory contains a .dart_tool/package_config.json file.
hasPackageConfig(String packagePath) bool
Whether packagePath contains a .dart_tool/package_config.json file.
isFlutterPackage(String packagePath) bool
Whether the package at packagePath is a Flutter package (e.g. declares sdk: flutter or depends on package:flutter).
isFlutterPubspec(String pubspecContent) bool
Whether pubspecContent indicates a Flutter package.
isValidSdk(String path) bool
Whether path looks like a Dart SDK root usable by the analyzer.
isValidSdkPath(String path) bool
Alias for isValidSdk.
parseLineBounds(String lines) → (int, int)
Parses a 1-based line range of format <start>-<end> (e.g. 45-80).
parseNonNegativeInt(String val, String name) int
Parses a non-negative integer or throws a FormatException.
resolveGitHubSummaryFile() File?
Resolves the GitHub Actions Step Summary markdown file from the environment, or null if not running inside GitHub Actions.
resolveSdkFromDir(String dir, String executableName) String?
Resolves an SDK root from a directory containing a dart executable.
resolveTargetFileAndLines(String rawTarget, {String? explicitLines}) → ({String filePath, String? linesString})
Resolves a file target and optional line specifier from command arguments.
runPubGet(String packagePath, {String? sdkPath, String? flutterRoot, List<String> additionalArgs = const []}) ProcessResult
Runs pub get (routing to flutter pub get or dart pub get) for the package at packagePath.

Exceptions / Errors

AnalyticaException
Base exception for all Analytica tooling errors with exit code support.
CliException
General CLI exception with an explicit exit code.
MissingInputException
Thrown when a required input file or directory is missing.
PackageResolutionException
Thrown when package configuration or dependencies are unresolved.
SdkDiscoveryException
Thrown when a usable Dart SDK cannot be located or a provided SDK path is not a valid SDK root.
UsageException
Thrown when CLI argument parsing or user input validation fails.