execute method

  1. @override
Future<void> execute()
override

execute command

Implementation

@override
Future<void> execute() async {
  var isDev = containsArg('--dev') || containsArg('-dev');
  var runPubGet = false;

  for (var element in args) {
    var packageInfo = element.split(':');
    LogService.info('Installing package "${packageInfo.first}" …');
    if (packageInfo.length == 1) {
      runPubGet = await PubspecUtils.addDependencies(packageInfo.first,
              isDev: isDev, runPubGet: false)
          ? true
          : runPubGet;
    } else {
      runPubGet = await PubspecUtils.addDependencies(packageInfo.first,
              version: packageInfo[1], isDev: isDev, runPubGet: false)
          ? true
          : runPubGet;
    }
  }

  if (runPubGet) await ShellUtils.pubGet();
}