getPubGlobalInstalledPackages function
Get the list of packages activated with dart pub global activate (with a
local cache, per isolate).
force lists them again (dart pub global list) and refreshes the cache,
i.e. when another process might have activated or deactivated a package.
Implementation
Future<List<String>> getPubGlobalInstalledPackages({
bool? force,
bool? verbose,
}) async {
if (force ?? false) {
_installedGlobalPackages = null;
}
var future = _installedGlobalPackages ??= _listInstalledGlobalPackages(
verbose: verbose ?? false,
);
try {
return await future;
} catch (_) {
// Don't cache a failure.
if (identical(_installedGlobalPackages, future)) {
_installedGlobalPackages = null;
}
rethrow;
}
}