getAutoUpdaterDisabledReason method

AutoUpdaterDisabledReason? getAutoUpdaterDisabledReason()

Implementation

AutoUpdaterDisabledReason? getAutoUpdaterDisabledReason() {
  final envMap = Platform.environment;
  if (envMap['NODE_ENV'] == 'development') {
    return const AutoUpdaterDisabledDevelopment();
  }
  if (_isEnvTruthy(envMap['DISABLE_AUTOUPDATER'])) {
    return const AutoUpdaterDisabledEnv(envVar: 'DISABLE_AUTOUPDATER');
  }
  final essentialReason = _getEssentialTrafficOnlyReason(envMap);
  if (essentialReason != null) {
    return AutoUpdaterDisabledEnv(envVar: essentialReason);
  }
  final config = getGlobalConfig();
  if (config.autoUpdates == false &&
      (config.installMethod != InstallMethod.native ||
          config.autoUpdatesProtectedForNative != true)) {
    return const AutoUpdaterDisabledConfig();
  }
  return null;
}