Create a Patch
Once you have published a release of your app, you can push updates using one of
the shorebird patch commands.
Patching multiple platforms simultaneously
Section titled “Patching multiple platforms simultaneously”If your app supports multiple platforms, you can build and publish patches for
them in a single command using the --platforms (or -p) option:
This will build and promote the patches for the specified platforms to their respective releases in one step.
This will do several things:
- Downloads the corresponding release artifacts.
- Builds the artifacts for the update.
- Generates a patch using the diff between the release and the current changes.
- Uploads the patch artifacts to the Shorebird backend.
- Publishes the patch to the track you pass with
--trackor choose when asked. See Tracks.
Example output:
Each patch is for one release version. See Release versions for how Shorebird uses your app’s version.
To choose the release, pass --release-version:
--release-version latest targets the most recently updated release for that
platform:
Without --release-version, shorebird patch asks you to pick a release when
it runs in a terminal. When it can’t ask, as in CI, always pass
--release-version. Without it, shorebird patch builds the app first and
reads the release version from the build, and can reuse that build as the patch,
without the release’s settings, such as obfuscation. An Android archive (aar)
or iOS framework for add-to-app has no version to read, so pass the host app’s
release version.
In CI, pass the exact version of the release your users have, such as
--release-version 1.0.0+1, when you might have a newer release that hasn’t
shipped yet. latest targets the most recently updated release, which may be
that newer one.
A patch is built with the Flutter version of its release and can’t change it. Shorebird 1.6.135 and newer warn when that version has a known problem on the platform you’re patching, such as the iOS crash in Flutter 3.44.
If your application supports flavors or multiple release targets, you can
specify the flavor and target using the --flavor and --target options:
Options
Section titled “Options”The options on this page cover most patches: --release-version, --track,
--platforms, --flavor and --target. A few others come up often:
--dry-run(-n) builds and checks the patch without uploading it, which is useful in CI.--export-options-plistpoints an iOS patch at the sameExportOptions.plistas its release.--min-link-percentagesets how much of an iOS patch’s Dart code must run natively rather than in the interpreter. Shorebird 1.6.135 and newer default to20;0accepts any patch. See Link percentage and slow patches.--allow-native-diffsand--allow-asset-diffspublish a patch even when Shorebird detects native or asset changes. They’re not recommended: a patch can’t change native code or assets.
Run shorebird patch --help for every option.
Patch performance
Section titled “Patch performance”Android, macOS, Linux and Windows
Section titled “Android, macOS, Linux and Windows”Patching an application on these platforms has no effect on performance. A patch replaces your app’s compiled Dart code with a newly compiled version, so all of it runs on the CPU as before.
Patching an application on iOS typically does not affect application performance. However, the patching mechanism on iOS is different from other platforms. Unchanged code runs as normal (on the CPU), changed (or added) code will run in a Dart interpreter (slower than the CPU). Typically this change is undetectable, but if you are changing particularly performance-sensitive Dart code (e.g., code for processing images, or large datasets), you may see a performance difference after patching.
You can always test your patches before sending them to users by staging patches. For a detailed look at how iOS patching works, see System Architecture.
If you ever see unexpected performance changes when patching, please reach out for help.
Manage patches
Section titled “Manage patches”You can manage your patches directly from the command line using the
shorebird patches commands.
List patches
Section titled “List patches”To list all patches associated with a specific release version:
This will display a list of all patches published for that release, their patch numbers, active status, and tracks.
View patch details
Section titled “View patch details”To view detailed information for a specific patch number:
This command shows the patch’s ID, track, whether it is rolled back, any notes, and the size of each platform and architecture artifact.
Promote a patch
Section titled “Promote a patch”If you published a patch to a staging track (e.g., staging) and verified it
works correctly, you can promote it directly to the stable track using:
promote is set-track with the track defaulting to stable. Older CLIs run
the same command but print a deprecation warning, and its --track,
--channel, --app-id, and --json flags need Shorebird 1.6.130 or newer.
Set patch track
Section titled “Set patch track”To assign a patch directly to a specific deployment track (e.g., promoting or routing to a staging beta group):
The --release-version and --patch-number flags of set-track need Shorebird
1.6.128 or newer. On an older CLI, use --release and --patch instead, or run
shorebird upgrade first.
Roll back or roll forward a patch
Section titled “Roll back or roll forward a patch”To stop serving a patch, roll it back. To serve it again later, roll it forward:
See Roll back a Patch for what happens on devices and the options these commands take.
Delete a patch
Section titled “Delete a patch”Individual patches can’t be deleted. A patch is removed along with the release it belongs to, or the app that owns that release. Those deletions are permanent, and the console asks you to confirm before anything is removed.
See Delete Apps, Releases, and Patches for details.