Generating and managing bundles for Flutter SDK
To push translation updates to your Flutter app, you need to generate a Flutter SDK bundle.
These bundles are registered in Lokalise OTA Service and can be managed through the UI on Projects > Settings > OTA Bundles > Flutter SDK. If you don't see the OTA Bundles or the Flutter SDK tab, most likely your project haven't been migrated to a newer OTA version. To resolve this issue, please reach out to our support team and provide your project ID.
You can assign the Production and Prerelease tags to the generated bundles. One bundle can have both tags, but each tag can be assigned to one bundle only.
You can also fine-tune what bundles are served to your customer by using bundle freezes.
Preparing your translation keys
Platform
In order to include translation keys on a Flutter SDK bundle, the keys must be assigned to the Other platform type. You can adjust the key platforms on the key editor.
Key names
If you use translation keys on multiple platforms, you may need to adopt a distinct naming syntax for keys to function on each platform. In this case, you can enable Per platform key-names on your Lokalise project.
For Flutter, key names must correspond to a valid Dart method identifier: lowerCamelCase
(preferably, according to the Dart Style Guide), lowercase_with_underscores
or UpperCamelCase
.
Generating a Flutter SDK bundle
To generate a bundle you simply need to:
- Open the Download page on your Lokalise project.
- Select the Flutter SDK format.
- Press the Build only button.
In order to optimize the size of the OTA bundle, we recommended that you only include the modified translations onit. You can check the blog post that sums up the recommended practices.
You can also use the Download files endpoint by the Lokalise API (hint: Use the flutter_sdk
format).
Managing bundles
The existing bundles can be viewed in Settings > OTA Bundles > Flutter SDK.
The first bundle is always tagged as Production and Prerelease. New bundles are tagged as Prerelease (the latest bundle is always Prerelease by default).
You can update the bundle name, change the tags, and delete the bundles using this UI. Remember to press Save changes when you move tags.
Alternatively, you use Lokalise OTA API to manage the bundles. Please refer to Working with the OTA API documentation to do that.
Managing bundle freezes
Bundle freezes can be used to restrict a generated bundle to specific versions of your application; they're a core aspect of our recommended practices for OTA and mobile SDKs. Managing bundle freezes is also possible on the Flutter SDK page.
To enable the bundle freeze functionality, Flutter SDK uses the version
key from the pubspec.yaml
located in the Flutter project root.
Given a version: 1.2.3+4
value, 1.2.3
is extracted and passed to the OTA Service.
Updated over 1 year ago