publish method
void
publish(
- String pubspecPath, {
- required bool autoAnswer,
- required bool dryrun,
})
Implementation
void publish(String pubspecPath,
{required bool autoAnswer, required bool dryrun}) {
final projectRoot = dirname(pubspecPath);
final version = Version.parse(Platform.version.split(' ')[0]);
var cmd = 'dart pub publish';
if (version.major == 2 && version.minor < 9) {
cmd = 'pub publish';
}
if (dryrun) {
cmd += ' --dry-run';
}
if (autoAnswer) {
cmd += ' --force';
}
cmd.start(workingDirectory: projectRoot, terminal: true, nothrow: true);
}