AirBuildCodePushOverlay class
A drop-in widget that runs the whole manual CodePush lifecycle for you: it checks for a patch on launch (optionally periodically and on resume), downloads it, and shows a "restart to apply" banner once staged.
This is the zero-effort alternative to wiring
AirBuildCodePush.checkForUpdate + AirBuildCodePush.update +
showRestartBanner yourself. It only drives Dart-initiated checks —
use it with auto_update: false in shorebird.yaml, otherwise the
engine's boot thread already patches the stable (production) channel
and this overlay is only useful for non-production channels.
Place it inside your MaterialApp so it inherits Theme/MediaQuery —
the builder callback is the most reliable spot since it sits above the
Navigator and therefore covers every route:
MaterialApp(
builder: (context, child) => AirBuildCodePushOverlay(
config: AirBuildCodePushConfig(
channel: 'staging',
onRestart: () => Phoenix.rebirth(context),
),
child: child ?? const SizedBox.shrink(),
),
home: const HomePage(),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- AirBuildCodePushOverlay
Constructors
- AirBuildCodePushOverlay({Key? key, required Widget child, AirBuildCodePushConfig config = const AirBuildCodePushConfig(), AirBuildCodePush? codePush})
-
Creates the overlay.
childis your app content — typically thechildhanded toMaterialApp.builder, or your home screen.const
Properties
- child → Widget
-
The app content below the overlay's banner/debug bar.
final
- codePush → AirBuildCodePush?
-
The updater to drive. When
null, the overlay creates an AirBuildCodePush withconfig.channelandconfig.disableOnPlayStoreInstalls. Pass your own instance to share one with the rest of your app, or to inject a mock in tests.final - config → AirBuildCodePushConfig
-
Overlay behavior — see AirBuildCodePushConfig.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< AirBuildCodePushOverlay> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
maybeOf(
BuildContext context) → AirBuildCodePushOverlayState? -
The nearest AirBuildCodePushOverlay state above
context, ornullif the app isn't wrapped in one. Use it to read AirBuildCodePushOverlayState.status or to trigger AirBuildCodePushOverlayState.checkNow from your own UI.