Shorebird x Flutter: Some Things You Should Know.
Tags: codepush, flutter, mobile, flutterdev
Published: 2023-08-01 14:46:54

Shorebird is a fantastic CLI tool designed to simplify the process of quickly pushing product updates or fixes to users without the hassle of waiting for app store reviews from platforms like Apple or Google. It's a handy tool that allows developers to make immediate changes and improvements to their apps, making life easier for both developers and end-users alike.

If you're a mobile Flutter developer, having Shorebird in your toolbox is a real asset. However, to make the most of this tool, there are some essential things you should know. These insights will help you understand how Shorebird operates and empower you to use it effectively in your development workflow.

Below are the things you must understand so as to use Shorebird effectively.

- Shorebird Updater
- Release Update
- Patch Update

**Shorebird Updater:** 

Shorebird Updater serves as the engine responsible for managing the download and installation of new updates (patches) on your users' devices whenever they become available. To ensure smooth functionality, the updater needs to be packaged with your application. As a result, during the installation process of Shorebird, [a forked version of the Flutter engine](https://docs.shorebird.dev/faq#how-does-shorebird-relate-to-flutter) will also be downloaded since it includes the necessary components of the updater. This ensures that your app stays up-to-date effortlessly, providing your users with the latest improvements and fixes without any delays. 
Don't worry; we have a guide that explains how to set up Shorebird on your computer, [here](https://dev.to/dev_toykam/shorebird-x-flutter-340h).
You can read more about this [here](https://docs.shorebird.dev/faq#how-does-shorebird-relate-to-flutter)

**Release Update:**

This scenario is comparable to when we execute the following commands in Flutter.

```
flutter build appbundle // for android
flutter build ipa // for ios
```
When you run the above command, the build/artifacts you obtain are the same as those you get from using the `shorebird release [platform]` command. However, there's an important distinction between the two processes. When you execute the shorebird release command, it employs a modified version of the Flutter engine (a forked version) to create the build/artifacts. The reason for using this modified version is to seamlessly integrate the updater we discussed earlier into the build. This ensures that the updater becomes an integral part of the final application package, enabling it to effectively handle updates on users' devices. In simple terms, the shorebird release command ensures that your app includes the necessary tools to manage updates smoothly for your users. 
The build/artifacts obtained from `shorebird release [platform]` command must be distributed to your users so as to be able to get later patch update on that release.

```
shorebird release android // for android
shorebird release ios-alpha // for ios
```

> All release obtained from the `shorebird release [platform]` command must be distributed to user (for example: uploading it to google play / apple store) as they are not available to them over-the-air.

> Shorebird saves the compiled Dart code from your application in order to make updates smaller in size.

> To view the list of your app releases, simply run the command `shorebird releases list` in your terminal or command prompt.

For a more detailed understanding of the process, you can refer to the documentation provided [here](https://docs.shorebird.dev/code_push/release).

**Patch Update:**

After you have published your release update, you have the capability to quickly push fixes/features, which are referred to as patches, to your users. Once these updates are ready, they will be automatically downloaded the moment your users open your app on their devices. The changes will then take effect the next time your users use your app.

To push a patch, simply run any of the commands below depending on the platform you want to push a patch for:

```
shorebird patch android // for android
shorebird patch ios-alpha // for ios
```

The command mentioned above will carry out the following action:

1. Builds the artifacts for the update.
2. Downloads the corresponding release artifacts.
3. Generates a patch using the diff between the release and the current changes.
4. Uploads the patch artifacts to the Shorebird backend
5. Promotes the patch to the stable channel.

That covers the basics, but it's not the entirety of what you need to know. There's more to explore and understand beyond what has been mentioned so far.

It's essential to keep in mind that not all updates you make to your app can be provided as patches using Shorebird. Shorebird's patch updates are specifically designed for changes that involve Dart code only (at least for now). If your update includes changes to assets or platform-specific code, you'll need to distribute it as a new release update instead as discussed above.

> When you push a patch, you don't need to publish the store,  as the patch will be available your users with the help of the updater packaged in to your app as discussed earlier.
> You also don't need to update the version or build number

---

Thank you for taking the time to explore this article with us. We hope you found it informative and engaging. Your interest and support inspire us to continue creating valuable content for you.

If you have any questions, feedback, or suggestions, we would love to hear from you. Feel free to reach out and share your thoughts.