effidevFlutter · Cloudflare edge · Cloud cost optimization
English

Flutter CodePush with Shorebird: Instant Live Hotfix Deployment & Zero-Downtime OTA Patches

Flutter CodePush Real-time Hotfix Architecture with Shorebird

Discovering a critical bug in a production mobile app can result in severe revenue loss and user churn while waiting hours or days for App Store and Google Play review approvals.

Unlike React Native’s historical AppCenter CodePush ecosystem, Flutter compiles Dart code directly into native AOT (Ahead-Of-Time) machine code binaries, making live CodePush updates notoriously difficult.

Founded by Eric Seidel (co-founder of Flutter), Shorebird resolves this challenge through a modified Dart VM runtime. Shorebird enables Flutter developers to push instant Over-The-Air (OTA) Dart code patches directly to user devices without resubmitting binaries to app stores.

This guide covers Shorebird runtime mechanics, App Store guideline compliance, shorebird CLI workflows, and best practices for production hotfix management.

Key Takeaways

  • Modified Dart Runtime: Shorebird embeds a custom Dart VM that downloads lightweight delta patches, interpreting modified Dart functions while maintaining native performance for unchanged code.
  • Store Guideline Compliance: Fully compliant with Apple App Store Review Guideline 3.3.2 (interpreted code execution) and Google Play Developer Policies.
  • Performance: Native AOT performance is preserved for 99%+ of the codebase, with interpreter overhead restricted strictly to patched functions.
  • Scope & Limits: Pure Dart logic changes are fully supported. Modifications to C++/Native plugins, Android Manifest, or new native asset additions require standard app store releases.

1. How Shorebird Works: AOT + Interpreter Hybrid

Flutter AOT compiles Dart code to ARM64 machine code binaries. Modifying machine code directly violates iOS code signing policies.

Shorebird bypasses this via a hybrid execution model:

  1. Base Release: shorebird release fingerprints binary symbols and creates a baseline state on the Shorebird server.
  2. Patch Creation: shorebird patch isolates modified Dart functions and generates a compact Patch Delta File.
  3. Runtime Execution: The client-side Shorebird engine downloads the patch. Unchanged code executes at native AOT speeds, while modified functions switch seamlessly to the VM interpreter.

2. Project Initialization & Workflow

1) Install Shorebird CLI

curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/shorebirdtech/install/main/install.sh | sh

2) Initialize Project (shorebird init)

Run shorebird init in your project root to generate shorebird.yaml:

# shorebird.yaml
app_id: 8f3a9b12-3c4d-5e6f-7a8b-9c0d1e2f3a4b

3. Production Release & Patch Deployment

Step 1: Generate Base Release Binaries

# Build Android App Bundle for Google Play
shorebird release android

# Build iOS IPA for App Store
shorebird release ios

Step 2: Deploy Instant Hotfix Patches

When a critical Dart bug is fixed in your codebase, push an OTA patch immediately:

# Deploy Android Hotfix Patch
shorebird patch android

# Deploy iOS Hotfix Patch
shorebird patch ios

Patches propagate to global CDNs within seconds. Users receive the updated patch silently upon their next app restart.


4. Programmatic Client Control (shorebird_code_push)

import 'package:flutter/material.dart';
import 'package:shorebird_code_push/shorebird_code_push.dart';

final _shorebirdCodePush = ShorebirdCodePush();

Future<void> checkForHotfixPatch(BuildContext context) async {
  final isUpdateAvailable = await _shorebirdCodePush.isNewPatchAvailableForDownload();

  if (isUpdateAvailable) {
    await _shorebirdCodePush.downloadUpdateIfAvailable();
    if (context.mounted) {
      ScaffoldMessenger.of(context).showSnackBar(
        const SnackBar(content: Text('Patch downloaded. Restart app to apply.')),
      );
    }
  }
}

Conclusion

Shorebird eliminates store review anxiety for Flutter development teams, providing a reliable safety net for shipping zero-downtime hotfixes directly to production.