Ship Faster with Shorebird: OTA Updates in Flutter | Squareboat Engineering
What are Over-the-Air Updates in Flutter?
Introduction to OTA Updates
- Sumit Kushwaha introduces himself and the topic of the presentation, focusing on Over-the-Air (OTA) updates in Flutter.
- OTA updates refer to the delivery of software, firmware, and configuration updates directly to mobile applications without needing store approval.
Benefits of OTA Updates
- The process allows for seamless updates that keep devices secure and bug-free with minimal user intervention.
- Key benefits include:
- Convenience: No physical media required for software updates.
- Efficiency: Multiple devices can be updated simultaneously.
- Security: Regular patches enhance app security over time.
- Cost Savings: Reduces distribution costs for manufacturers by eliminating physical media.
How Does Flutter Integrate with OTA Updates?
Introduction to Shorebird
- Shorebird is an open-source tool created by the Flutter team that facilitates OTA updates similar to React Native's code push feature.
- It works across all platforms where Flutter operates, including Windows, Android, Apple, and Linux.
Deployment Process
- Developers first build their application using Shorebird before uploading it to app stores. Subsequent patches are recognized by Shorebird after initial deployment.
- The integration is straightforward; it requires installation and command-line interface (CLI) control for ease of use.
Understanding How Shorebird Works
Architecture Overview
- The architecture consists of three layers: Embedder, Engine, and Framework. Shorebird interacts primarily with the Framework layer.
Compilation Techniques
- Dart provides two compilation techniques: Just-In-Time (JIT), used during development for quick changes visibility; and Ahead-of-Time (AOT), used when preparing apps for production deployment.
Patch Management with Shorebird
Update Mechanism
- When a patch is released or a build is made, Shorebird generates a diff of the code indicating new library files that need updating.
- Upon app launch, Shorebird checks with the server for any available patches. If found, it downloads and replaces existing files seamlessly.
Traditional vs. Shortbird App Update Approaches
Overview of Traditional App Updates
- Traditional app updates involve pushing an update through app stores, which includes a review period before distribution to users.
- In contrast, Shortbird allows for immediate updates by skipping the review process, enabling direct distribution to users upon launch.
Functionality of Shortbird
- When a user launches the app, it checks with the Shortbird server for any available patches and downloads them without installing immediately.
- The updated patch is stored as metadata; changes are reflected only on subsequent launches after installation.
Installing and Initializing Shortbird
Installation Process
- To install Shortbird, run a command that integrates it into your device's system.
- After installation, you log in using an associated account (e.g., Google), initializing Shortbird within your project.
Project Creation
- A new project is created in Shortbird where you specify the project name and other details necessary for integration.
Building and Patching with Shortbird
Building Your App
- Instead of using
flutter build, you useshortbird buildto integrate it into your app files effectively.
- This integration allows the app to recognize when it needs to download certain patches from Shortbird.
Demonstration of Bug Fixing
- A demonstration shows how to fix a bug in the Legistify application without going through traditional approval processes from app stores.
Coding Practices and Patch Management
Importance of Simple Checks
- Developers often forget simple checks that can lead to frustration; these need addressing without requiring full version increments or builds.
Creating Patches
- Running specific commands creates patches that apply fixes made in recent builds, akin to applying a bandage over issues identified.
Limitations and Considerations with Patching
Free Tier Limitations
- Using a free tier account allows up to 5000 patches per month but does not mean 5000 individual pushes; rather, each patch can be downloaded by multiple devices.
Scope of Changes Allowed
- Changes via patches are limited; they cannot include new assets or permissions directly affecting native code or manifest files on Android devices.
Benefits of Using Shortbird
Fast Delivery and Smaller Downloads
- The primary advantage is faster delivery times for small changes while minimizing data usage since only essential framework files are downloaded.
Rollback Options
- Users have options to roll back patches if issues arise post-deployment, ensuring flexibility in managing updates effectively.
Fixing Issues with Screen Pop-ups
Importance of Efficient Development Processes
- The issue of pop-ups not appearing on screens has been resolved, indicating a successful troubleshooting process.
- The discussion highlights how Shorbird aids developers by minimizing the need for frequent builds for small changes, streamlining the development workflow.
Client Communication and Project Management
- A suggestion was made to ask Anubhav to communicate with clients regarding upcoming projects, emphasizing proactive client engagement.
- It is noted that this service or tool is available for free, which may encourage more users to adopt it in their workflows.