AirBuildCodePush constructor

AirBuildCodePush({
  1. String defaultChannel = 'production',
  2. bool disableOnPlayStoreInstalls = false,
  3. @visibleForTesting ShorebirdUpdater? updater,
  4. @visibleForTesting Future<bool> playStoreInstallProbe()?,
})

Creates a wrapper around Shorebird's updater.

defaultChannel is used by checkForUpdate and update when no channel is passed explicitly. Defaults to "production", matching the default channel used by airbuild codepush flutter promote.

disableOnPlayStoreInstalls disables Dart-driven patch checks and downloads when the running build was installed from the Google Play Store (com.android.vending) — useful if you want OTA patches for AirBuild-distributed/sideloaded installs only. checkForUpdate returns UpdateStatus.unavailable and update becomes a no-op on Play-installed devices; currentPatch/nextPatch still report patch state. The check fails open: if the install source can't be determined (sideloads, ADB, older APIs), updates stay enabled.

Note: this flag only gates checks made through Dart. The engine's boot-time updater thread (auto_update: true in shorebird.yaml) runs before Dart starts and is unaffected — combine this flag with auto_update: false for a complete opt-out.

Implementation

AirBuildCodePush({
  String defaultChannel = 'production',
  bool disableOnPlayStoreInstalls = false,
  @visibleForTesting ShorebirdUpdater? updater,
  @visibleForTesting Future<bool> Function()? playStoreInstallProbe,
})  : _defaultChannel = defaultChannel,
      _disableOnPlayStoreInstalls = disableOnPlayStoreInstalls,
      _updater = updater ?? ShorebirdUpdater(),
      _playStoreInstallProbe = playStoreInstallProbe ?? isPlayStoreInstall;