validate static method
validate that the passed arguments points to a valid script
Implementation
static void validate(String scriptPath) {
if (!scriptPath.endsWith('.dart')) {
throw InvalidArgumentException(
'Expected a script name (ending in .dart) '
'instead found: $scriptPath',
);
}
if (!exists(scriptPath)) {
throw InvalidScript('The script ${truepath(scriptPath)} does not exist.');
}
if (!FileSystemEntity.isFileSync(scriptPath)) {
throw InvalidScript('The script ${truepath(scriptPath)} is not a file.');
}
}