freight 0.1.1
freight: ^0.1.1 copied to clipboard
Ship large assets outside your app bundle: iOS Managed Background Assets and Google Play Asset Delivery behind one Dart API.
Changelog #
0.1.1 #
- Corrected the README, which still said the package was not published — pub.flutter-io.cn renders the README from the published archive, so the claim was visible on the package's own page. Added the install snippet that was missing along with it.
0.1.0 #
-
Verified
FreightImageon hardware: a PNG shipped in an asset pack decodes and renders from the pack on an iPhone. The example draws it, which is what exercises the decode path — reading bytes does not. -
AssetPack.watchnow emits the pack's current state before any change. It previously forwarded only the platform's change notifications, so a pack that was simply sitting there downloaded looked unknown to aStreamBuilderuntil something happened to it — which for an already-downloaded pack may be never. On a device this showed up as the UI offering to download a pack it already had. -
Fixed the Background Assets extension point identifier, which was
com.apple.background-assets.content-requestand should becom.apple.background-asset-downloader-extension. With the wrong one the system never registers the downloader extension, andAssetPackManagertraps at first use with a message blaming the app for having no extension — on the Simulator and on hardware alike. Nothing else about the target was wrong, which is why this took a device to find. -
Documented that an install-time pack on Android cannot be resolved to a file path or read through a scoped bundle: Play merges those assets into the app itself, where they lose their pack identity.
Freight.readstill finds them unscoped. -
Added the Android runtime, backed by Play Asset Delivery, behind the same API as iOS:
ensureDownloaded, the status stream,readandresolveall work against downloaded asset packs, and install-time packs fall back to the ordinary asset manager. Two differences are worth knowing rather than discovering:allPackslists only packs already on the device, because Play has no API for the ones an app merely declares, andrequireLatestdoes nothing, because Play versions asset packs with the app. Generating the Gradle asset pack modules is handled byfreight_cli. -
Added a consumer ProGuard rule, so apps do not have to discover it themselves: the Play Asset Delivery Kotlin extensions reference a Play Services annotation that is not on the classpath, and R8 fails a release build over the missing class.
-
Moved the
freight buildandfreight doctorcommands into a separatefreight_clipackage, so an app depending onfreightno longer carriesargs,glob,pathandyamlfor tooling it never runs. This package now depends on nothing but Flutter. Addfreight_clias a dev dependency to build packs. -
Added the
freight doctorcommand. Managed Background Assets reports most misconfiguration by crashing on a device rather than returning an error, sodoctorlooks for those problems locally instead: a missingBAAppGroupID, an app group only one target holds, no downloader extension embedded, a pack whose globs match nothing, and an unusableba-package. -
Added the
freight buildcommand. It readsfreight.yaml, resolves each pack's globs, generates the asset-pack manifests and packages them with Apple'sba-package, and with--base-urlalso writes the download manifest a self-hosting server must serve. Each pack declares aroot, which is what decides the logical paths the app reads back: a file at<root>/nested/deep.txtis read asnested/deep.txtregardless of where the sources sit in the repository. -
Added
FreightBundle, anAssetBundlebacked by downloaded asset packs, andFreight.bundle()to build one. A pack addresses files by the logical path they had when it was built, which is what an asset key already is, so widgets taking a key can read from packs without knowing where the bytes came from. Keys no pack contains fall through to the app's own assets, so a single bundle serves both;FreightBundle.packsOnlyopts out of that when a silent fallback would hide a pack that was never downloaded. -
Added
FreightImage, anImageProviderreading from a downloaded pack. It does not download one — an image widget is the wrong place to begin a transfer that may be hundreds of megabytes, with nowhere to report progress. -
Fixed detection of the Background Assets downloader extension, which looked only in the app's
PlugIns/directory. ExtensionKit embeds extensions inExtensions/instead, so a correctly configured app was still told it had no extension. Both locations are now searched. -
Added
doc/ios-setup.md, a walkthrough of the iOS project configuration Managed Background Assets requires: adding the downloader extension with Xcode's Background Download Extension template, wiring the app group, building packs withba-package, self-hosting, and a table mapping each failure message to its actual cause. Several of those messages point at the wrong problem — a missingCFBundleIdentifierin the extension reports a bundle identifier prefix mismatch, for instance. -
Documented the iOS setup Managed Background Assets requires — the app group,
BAAppGroupID, and the downloader extension target — along with the fact that the system crashes rather than returning an error when either is missing.freightchecks both before touching the platform and throwsMissingAppGroupExceptionorMissingExtensionException.