packo
library
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
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 )