Utils class
Common utility functions shared by all tasks and commands
Constructors
- Utils()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- isInDocker → bool
-
Indicates whether or not this process is running in our docker image
no setter
-
relativePathRoots
→ Map<
KnownPaths, String> -
A map of expected KnownPaths relative to a workspace.
final
Static Methods
-
chmod(
String perms, String filePath, [String? workingDir]) → bool -
Runs a
chmod
command against thefilePath
in theworkingDir
using the providedperms
-
deleteIfExists(
String entityPath) → bool -
Deletes a FileSystemEntity by
entityPath
, only if it exists. IfentityPath
is a directory, it is deleted recursively. Returnstrue
if theentityPath
doesn't exist or was deleted, otherwisefalse
. -
dockerImageExists(
String name) → bool -
Indicates whether or not a docker image exists by
name
-
findFiles(
{String? subPath, String? rootDir, RegExp? matcher}) → Stream< File> -
An async Stream of File instances found responsive to the
matcher
within therootDir
/subPath
location on the file system. THerootDir
will default to Directory.current if not provided -
getCPUArch(
) → CpuArch - Checks the OS-reported CPU architecture and returns the appropriate internal CpuArch value.
-
getFinalDir(
String dirPath) → String -
Returns the result of
path.normalize
, as an absolute path from Directory.current. -
getGitHash(
[String? dirPath]) → String? -
Gets the git hash from
dirPath
, if it's a repo, otherwisenull
. -
getIaCValue(
String targetDir, String key) → String? -
Gets the value of
key
from theiac.json
file in thetargetDir
. -
getPubSpecValue(
String targetDir, String key) → String? -
Gets the value of
key
from thepubspec.yaml
file in thetargetDir
. -
getTempPath(
[String prefix = 'endaft']) → String - Creates a temporary Directory under the system temporary directory and returns the absolute path to it.
-
handleProcessResult(
ProcessResult result, Logger logger, [String indent = '', ProcessFinalizer? finalizer, String message = '']) → bool - Handles the child process results and outputs
-
installCommand(
String command) → bool -
Checks if
command
is executable on this system. -
isCommand(
String command) → bool -
Checks if
command
is executable on this system. -
pathFromRoot(
KnownPaths type, [String? rootDir, bool create = true]) → String -
Gets a path from within the
rootDir
for the specifiedtype
, this will optionallycreate
the directory if it doesn't already exist. -
readFile<
T> ({required File file, required FileParser< T> parser}) → T -
Attempts to read a File from the specified
filePath
, and parse it with the specifiedparser
. Common FileParser implementations are available from FileParsers. If the file doesn't exist, throws a FileSystemException -
readFilePath<
T> ({required String filePath, required FileParser< T> parser}) → T -
Attempts to read a File from the specified
filePath
, and parse it with the specifiedparser
. Common FileParser implementations are available from FileParsers. If the file doesn't exist, throws a FileSystemException -
readSchemaFile(
String filePath, [FileCreator? creator]) → JsonSchema -
Reads the file at
filePath
as aJsonSchema
-
toolPath(
String command) → String? -
Get the full path to
command
on this system, or null if thecommand
is not available.