packo library

Classes

BuildCompositor
BuildSettings
BuildStep<T>
BuildTransaction
Completer<T>
A way to produce Future objects and to complete them later with a value or error.
ConsolePrinterStepListener
DeployUtils
Edge
Import/Export dependencies are represented as edges in a directed graph.
Entrypoint
EnvProperty
EnvPropertySource
EventSink<T>
A Sink that supports adding errors.
FileEnvPropertySource
Future<T>
The result of an asynchronous computation.
FutureOr<T>
A type representing values that are either Future<T> or T.
Metrics
Stores global metrics. See the README for more details about each metric.
Model
The main container class to hold the data model. Returned from the buildModel function.
Modified
@modified annotation class.
MultiStreamController<T>
An enhanced stream controller provided by Stream.multi.
Node
Dart files are represented as nodes in a directed graph. See the README for more details about each node metric.
Package
PackageProvider
PackagesCollection
StepCollectEnvProperties
StepGuardEnvProperties
StepInjectSystemProperties
StepListener
StepMoveArtifacts
StepNormalizeEnvProperties
StepRunActualBuild
Stream<T>
A source of asynchronous data events.
StreamConsumer<S>
Abstract interface for a "sink" accepting multiple entire streams.
StreamController<T>
A controller with the stream it controls.
StreamIterator<T>
An Iterator-like interface for the values of a Stream.
StreamSink<S>
A object that accepts stream events both synchronously and asynchronously.
StreamSubscription<T>
A subscription on events from a Stream.
StreamTransformer<S, T>
Transforms a Stream.
StreamTransformerBase<S, T>
Base class for implementing StreamTransformer.
StreamView<T>
Stream wrapper that only exposes the Stream interface.
Subgraph
Subfolders are represented as subgraphs.
SynchronousStreamController<T>
A stream controller that delivers its events synchronously.
Timer
A countdown timer that can be configured to fire once or repeatedly.
YamlEvaluator
Zone
A zone represents an environment that remains stable across asynchronous calls.
ZoneDelegate
An adapted view of the parent zone.
ZoneSpecification
A parameter object with custom zone function handlers for Zone.fork.

Enums

BuildPlatform
BuildType
Directive
Import/Export directive used in Edge.
OutputFormat
Used in Model.getOutput.
StepStatus

Mixins

VerboseStep

Extensions

FutureExtensions on Future<T>
Convenience methods on futures.
FutureIterable on Iterable<Future<T>>
FutureRecord2 on (Future<T1>, Future<T2>)
Parallel operations on a record of futures.
FutureRecord3 on (Future<T1>, Future<T2>, Future<T3>)
Parallel operations on a record of futures.
FutureRecord4 on (Future<T1>, Future<T2>, Future<T3>, Future<T4>)
Parallel operations on a record of futures.
FutureRecord5 on (Future<T1>, Future<T2>, Future<T3>, Future<T4>, Future<T5>)
Parallel operations on a record of futures.
FutureRecord6 on (Future<T1>, Future<T2>, Future<T3>, Future<T4>, Future<T5>, Future<T6>)
Parallel operations on a record of futures.
FutureRecord7 on (Future<T1>, Future<T2>, Future<T3>, Future<T4>, Future<T5>, Future<T6>, Future<T7>)
Parallel operations on a record of futures.
FutureRecord8 on (Future<T1>, Future<T2>, Future<T3>, Future<T4>, Future<T5>, Future<T6>, Future<T7>, Future<T8>)
Parallel operations on a record of futures.
FutureRecord9 on (Future<T1>, Future<T2>, Future<T3>, Future<T4>, Future<T5>, Future<T6>, Future<T7>, Future<T8>, Future<T9>)
Parallel operations on a record of futures.
ListExt on List<T>
NumberRounding on num
Round to precision. Source: https://stackoverflow.com/a/32205216

Constants

alwaysIgnore → const String
excludePackages → const List<String>
modified → const Modified
@modified annotation. Ctrl+hover over the function to see the annotations! Usage:
precision → const int

Functions

binaryTreeCCD(int n) double
The CCD of a balanced binary tree of size n.
buildApp({required BuildSettings settings}) Future<void>
buildModel(Directory rootDir, {String ignoreGlob = '!**', bool showTree = true, bool showMetrics = false, bool showNodeMetrics = false}) Model
This is the main function for API usage. Returns a Model object.
computeACD(int ccd, int numNodes) double
Return the average component dependency. ACD = CCD / numNodes It can be interpreted as the average number of nodes that will need to change when one node changes. Lower is better.
computeCCD(Model model) int
Return the cumulative component dependency, which is the sum of all component dependencies. The CCD can be interpreted as the total "coupling" of the graph. Lower is better.
computeMetrics(Model model) Metrics
computeNCCD(int ccd, int numNodes) double
Return the normalized cumulative component dependency. This is the CCD divided by a CCD of a binary tree of the same size. If the NCCD is below 1.0, the graph is "horizontal". If the NCCD is above 1.0, the graph is "vertical". If the NCCD is above 2.0, the graph probably contains cycles. Lower is better.
computeNodeCDs(DirectedGraph<String> graph, Model model) → void
Compute the component dependency of each node. The component dependency (CD) is the number of nodes a particular node depends on directly or transitively, including itself.
computeNodeDegreeMetrics(DirectedGraph<String> graph, Model model) → void
Compute node inDegree, outDegree, isOrphan, and instability. inDegree is the number of nodes that depend on this node. outDegree is the number of nodes this node depends on. Instability is a node metric by Robert C. Martin related to the Stable-Dependencies Principle: Depend in the direction of stability. Instability = outDegree / (inDegree + outDegree) In general, node instability should decrease in the direction of dependency. In other words, lower level nodes should be more stable and more reusable than higher level nodes.
computeNodeSlocs(Model model) → void
computeOrphans(Model model) List<String>
A node that has inDegree and outDegree of 0 is an orphan.
computeTotalSloc(Model model) int
countSloc(File dartFile) int
Return the number of lines of code ignoring comments and blank lines. This is a naive SLOC counter. It doesn't deal correctly with comments inside multi-line strings or multi-line comments in the middle of code.
findPubspecYaml(Directory currentDir) File?
Searches up the directory tree until it finds the pubspec.yaml file. Returns null if pubspec.yaml is not found.
getDartFileNodes(Directory rootDir, String ignore, bool showNodeMetrics) Map<String, Node>
Returns a map of Dart files as Nodes.
getDartFiles(Directory rootDir, String ignore) Iterable<File>
Returns all Dart files recursively from the rootDir.
getDirTree(Directory rootDir, String ignore) List<Subgraph>
Recurses into the rootDir and gets all the subfolders as sugraphs.
getEdges(Directory rootDir, String ignore, File pubspecYaml, List<String> nodes) List<Edge>
Read each Dart file and get the import and export paths.
log2(num x) double
Base 2 log.
parseImportLine(String line) String?
Parse the import line to get the package or file path.
resolveFile(File thisDartFile, String relativeFile) File
Resolve one file relative to another.
resolvePackageFileFromPubspecYaml(File pubspecYaml, String packageFile) File
Convert to a relative file in lib directory, then resolve from pubspec.yaml.
runZoned<R>(R body(), {Map<Object?, Object?>? zoneValues, ZoneSpecification? zoneSpecification, Function? onError}) → R
Runs body in its own zone.
runZonedGuarded<R>(R body(), void onError(Object error, StackTrace stack), {Map<Object?, Object?>? zoneValues, ZoneSpecification? zoneSpecification}) → R?
Runs body in its own error zone.
scheduleMicrotask(void callback()) → void
Runs a function asynchronously.
unawaited(Future<void>? future) → void
Explicitly ignores a future.

Typedefs

ControllerCallback = void Function()
Type of a stream controller's onListen, onPause and onResume callbacks.
ControllerCancelCallback = FutureOr<void> Function()
Type of stream controller onCancel callbacks.
CreatePeriodicTimerHandler = Timer Function(Zone self, ZoneDelegate parent, Zone zone, Duration period, void f(Timer timer))
The type of a custom Zone.createPeriodicTimer implementation function.
CreateTimerHandler = Timer Function(Zone self, ZoneDelegate parent, Zone zone, Duration duration, void f())
The type of a custom Zone.createTimer implementation function.
ErrorCallbackHandler = AsyncError? Function(Zone self, ZoneDelegate parent, Zone zone, Object error, StackTrace? stackTrace)
The type of a custom Zone.errorCallback implementation function.
FastMapEnvProperty = Map<String, EnvProperty>
ForkHandler = Zone Function(Zone self, ZoneDelegate parent, Zone zone, ZoneSpecification? specification, Map<Object?, Object?>? zoneValues)
The type of a custom Zone.fork implementation function.
HandleUncaughtErrorHandler = void Function(Zone self, ZoneDelegate parent, Zone zone, Object error, StackTrace stackTrace)
The type of a custom Zone.handleUncaughtError implementation function.
PackageCallback = void Function(Package package)
PrintHandler = void Function(Zone self, ZoneDelegate parent, Zone zone, String line)
The type of a custom Zone.print implementation function.
RegisterBinaryCallbackHandler = ZoneBinaryCallback<R, T1, T2> Function<R, T1, T2>(Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2))
The type of a custom Zone.registerBinaryCallback implementation function.
RegisterCallbackHandler = ZoneCallback<R> Function<R>(Zone self, ZoneDelegate parent, Zone zone, R f())
The type of a custom Zone.registerCallback implementation function.
RegisterUnaryCallbackHandler = ZoneUnaryCallback<R, T> Function<R, T>(Zone self, ZoneDelegate parent, Zone zone, R f(T arg))
The type of a custom Zone.registerUnaryCallback implementation function.
RunBinaryHandler = R Function<R, T1, T2>(Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2), T1 arg1, T2 arg2)
The type of a custom Zone.runBinary implementation function.
RunHandler = R Function<R>(Zone self, ZoneDelegate parent, Zone zone, R f())
The type of a custom Zone.run implementation function.
RunUnaryHandler = R Function<R, T>(Zone self, ZoneDelegate parent, Zone zone, R f(T arg), T arg)
The type of a custom Zone.runUnary implementation function.
ScheduleMicrotaskHandler = void Function(Zone self, ZoneDelegate parent, Zone zone, void f())
The type of a custom Zone.scheduleMicrotask implementation function.
StringEvaluator = String Function(String src)
ZoneBinaryCallback<R, T1, T2> = R Function(T1, T2)
ZoneCallback<R> = R Function()
ZoneUnaryCallback<R, T> = R Function(T)

Exceptions / Errors

AsyncError
An error and a stack trace.
DeferredLoadException
Thrown when a deferred library fails to load.
ParallelWaitError<V, E>
Error thrown when waiting for multiple futures, when some have errors.
PubspecYamlNotFoundException
Thrown by buildModel if pubspec.yaml can't be found in or above the rootDir.
TimeoutException
Thrown when a scheduled timeout happens while waiting for an async result.