[native_assets_cli] Asset
build-time classes and run-time classes
#2135
Labels
Milestone
Asset
build-time classes and run-time classes
#2135
While discussing with @mosuem we realized that many asset types will have a build-time API and run-time API in the same package.
This is nice, because it means that the these APIs can point to each other:
This is nice because the runtime API is version locked with the declaration API. So for assets built on top of data assets the serialization to JSON/bytes/... in the build hook and deserialization at runtime does not have to deal with version skew.
(
CodeAsset
s are weird because they use@Native
as runtime API.DataAsset
s are somewhat special because the implementation is in the SDK, but the public API is still in a package: currentlypackage:assets
. This should most likely be moved to be together withpackage:data_assets
which should also contain the declaration.)The API used at runtime and build-time should be disjoint, which calls for having two libraries which can be imported separately:
package:my_asset/declaration.dart
for use in hooks.package:my_asset/my_asset.dart
for use at runtime.Now, we have a questions about naming.
MyAsset
since they're available under different import paths, but that's likely going to be very confusing.)DataAssetDeclaration
,DataAssetDefinition
,BuildDataAsset
, ...DataAsset
package:data_assets/for_hooks.dart
,package:data_assets/declaration.dart
, ...package:data_assets/data_assets.dart
,package:data_assets/runtime.dart
,package:data_assets/use.dart
, ...The text was updated successfully, but these errors were encountered: