isGloballyInstalled static method

Future<bool> isGloballyInstalled()

Check if SmartPub is globally installed

Implementation

static Future<bool> isGloballyInstalled() async {
  try {
    final result = await Process.run(
      'dart',
      <String>['pub', 'global', 'list'],
      runInShell: true,
    );

    if (result.exitCode == 0) {
      final output = result.stdout.toString();
      return output.contains('smartpub ');
    }

    return false;
  } catch (e) {
    return false;
  }
}