AirBuildCodePush class
A thin, AirBuild-branded wrapper around Shorebird's ShorebirdUpdater.
This does not talk to AirBuild's server directly — the actual patch
check/download happens in Shorebird's updater runtime, which is compiled
into your app and configured via shorebird.yaml's base_url field to
point at your AirBuild server instead of Shorebird's own cloud:
# shorebird.yaml
app_id: <your-shorebird-app-id>
base_url: https://airbuild.dev
What this class adds on top of ShorebirdUpdater is:
- Mapping AirBuild's channel names (e.g.
"production","staging") onto Shorebird's UpdateTrack concept, so app code can talk about "channels" consistently with the AirBuild dashboard/CLI.
This is a different feature from AirBuild.checkForUpdates() in
package:airbuild/airbuild.dart — that checks whether a new binary
build (APK/IPA) is available on AirBuild and prompts the user to
install it. This class manages patches applied on top of the build
that's already installed. Apps can use either, both, or neither.
Update modes (set auto_update in shorebird.yaml):
auto_update: true(default): the engine's boot thread automatically checks thestablechannel on every launch and installs production patches in the background — no code needed, but channels are not selectable and the boot check ignores this class.auto_update: false: nothing happens automatically; drive updates yourself via checkForUpdate/update, which also enables per-device channel selection (e.g.AirBuildCodePush(defaultChannel: 'staging')).
If the updater isn't available (e.g. running a debug build, or a platform Shorebird doesn't support), every method degrades gracefully instead of throwing — check isAvailable if you need to know why no update was found.
Constructors
-
AirBuildCodePush({String defaultChannel = 'production', bool disableOnPlayStoreInstalls = false, @visibleForTesting ShorebirdUpdater? updater, @visibleForTesting Future<
bool> playStoreInstallProbe()?}) - Creates a wrapper around Shorebird's updater.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isAvailable → bool
-
Whether the Shorebird updater is available on this build/platform.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
checkForUpdate(
{String? channel}) → Future< UpdateStatus> -
Checks AirBuild (via the Shorebird updater) for a new patch on
channel(defaults to the channel this instance was configured with). Returns UpdateStatus.unavailable if the updater isn't available rather than throwing. -
currentPatch(
) → Future< Patch?> -
Returns the currently installed patch, or
nullif the app is running the release build with no patch applied (or the updater is unavailable). -
nextPatch(
) → Future< Patch?> -
Returns the most recently downloaded patch (which may not be applied
yet — see UpdateStatus.restartRequired), or
nullif none has been downloaded. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
{String? channel}) → Future< void> -
Downloads and installs the latest patch on
channel(defaults to the channel this instance was configured with). The patch takes effect on the next full app restart — this call does not restart the app for you.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
trackForChannel(
String channel) → UpdateTrack - Maps an AirBuild channel name to Shorebird's UpdateTrack.