Initialize Shorebird
To configure an existing Flutter project to use Shorebird, use shorebird init
at the root of a Flutter project:
This does three things:
- Tells Shorebird to create a unique
app_id
for your app. Thisapp_id
is how Shorebird identifies your app and knows which updates to send to it. It does not need to be kept secret. - Creates a
shorebird.yaml
file in your project’s root directory.shorebird.yaml
contains theapp_id
mentioned above. - Adds the
shorebird.yaml
to the assets section of yourpubspec.yaml
file, ensuringshorebird.yaml
is bundled with your app’s assets and is available to the Shorebird updater at runtime.
You can safely commit these changes, they will have no affect on your app when not using Shorebird.
Example output for an app named shorebird_test
:
The generated shorebird.yaml
should look similar to:
If your application contains flavors, shorebird init
will create an app per flavor and shorebird.yaml
will include all flavors and their corresponding app_ids
:
The app_id
is a required field in every shorebird.yaml
. In the case of flavors, app_id
will default to the first flavor and will be overwritten at build time to the corresponding flavor’s app_id
.
Shorebird code push requires the internet permission to be added to your
AndroidManifest.xml
file (located in
android/app/src/main/AndroidManifest.xml
). This is required for the app to be
able to communicate with the Shorebird servers to download patches.
shorebird init
will add this permission if it is not already present.