isActivatedFromPub function

bool isActivatedFromPub()

Determines whether the CLI was activated from the public pub.flutter-io.cn repository.

Returns true if the command is running from pub cache (activated via dart pub global activate), false if running from source or other locations.

Implementation

bool isActivatedFromPub() {
  if (_isInPubCache(Platform.resolvedExecutable)) {
    return true;
  }

  if (_isInPubCache(Platform.script.path)) {
    return true;
  }

  return false;
}