Shorebird CLI | Deploy Flutter app updates instantly
As a mobile application developer, the most challenging task is to ensure that all users have installed the latest update as soon as possible after release because previous builds can have some bugs or you want users to be updated instantly with new features. You can ask users to update the app by showing some messages but you cannot force them to update. There is a solution for this problem, and that is Shorebird CLI which is the topic of this article. Shorebird is a cloud service that allows developers to push app updates directly to users’ devices. For now, it is available only on Android but according to Shorebird, they will release IOS support in July 2023. In this article, we will see how to integrate Shorebird with your existing Flutter application.
How Shorebird works:
Shorebird is a code push service which is also called “Over The Air Updates” (OTA). It is not a new term and there are some already available OTA Services for other platforms. Basically how it works is that a new version of the software is built and uploaded to an update server, and then it is fed to the respective devices through the internet. It is a commonly used technique for IOT devices
Pricing:
Before the latest release, shorebird services were not free but latest release, you can use Shorebird free for small apps or demos.
Here you can see the pricing structure of Shorebird:
Initialization:
First, you have to download Shorebird in your system.
Windows:
Open PowerShell and run:
Set-ExecutionPolicy RemoteSigned -scope CurrentUser #Need to exucute remote scripts
iwr -UseBasicParsing 'https://raw.githubusercontent.com/shorebirdtech/install/main/install.ps1'|iex
Mac/Linux:
curl proto 'https=' --tlsv1.2 https://raw.githubusercontent.com/shorebirdtech/install/main/install.sh -sSf bash
After successful installation, restart the terminal and verify the installation by running this command:
shorebird doctor
Note: if you are using an older version of Flutter, it might return a problem that Shorebird’s and the system’s Flutter versions are different, but don’t worry about this message, and keep using Shorebird.
Now create an account or log in to your existing account by these commands:
Signup:
shorebird account create
Login:
shorebird login
This will return a URL to open on your browser and authenticate with your Google account. After authentication, you are able to use Shorebird.
Initialize Flutter Project:
Shorebird’s initialization in the Flutter project is very simple, just run this command to init shorebird:
shorebird init
After confirming your application name, shorebird will be initialized. Verify initialization by checking shorebird.yaml file in the project root directory.
Run:
You can run the app after Shorebird initialization by using the normal flutter run command or using Shorebird run command. shorebird run command will not work on the emulator so you can use simple flutter run command for development.
Release:
Making a release build by using Shorebird is very easy. Just run this command:
shorebird release android
and after processing, it will make “app-release.aab” file and you can upload it manually on the Play console after setting up your app. Currently, shorebird doesn't support auto-deployment so you have to release the first release manually.
Patch/Update:
Once you have published a release of your app, you can push updates using this command:
shorebird patch android
this will instantly push your update to users without updating the app.
End
This was a short tutorial on how to use Shorebird. For more info, you can check out Shorebird’s Website.
Note: Most app stores prohibit shipping code that changes the behavior of the app in a significant way. Also, Shorebird does not support changing native code (e.g. Java/Kotlin on Android or Objective-C/Swift on iOS). The tool will warn you during an attempted patch if you have changed the native code.
If you learned anything from this article,
Connect On LinkedIn:
https://www.linkedin.com/in/syedahmedusman2/
Follow On Github: