Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource files with native assets #55195

Open
Dampfwalze opened this issue Mar 14, 2024 · 2 comments
Open

Resource files with native assets #55195

Dampfwalze opened this issue Mar 14, 2024 · 2 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@Dampfwalze
Copy link

Dampfwalze commented Mar 14, 2024

The native assets feature is intended to build and bundle native libraries with a Dart application and abstract away the resolution and loading of these libraries.

This idea can be extended to any resource that one would want to bundle with an application. These resources can be text files, images, binary data, etc. Similar to native libraries, these can be bundled as files next to the applications executable, or they can be bundled directly into the executable.

These resources could be registered in build.dart, just like native libraries. This also allows to generate resources at compile time.

Native assets are identified using library uris, like package:a/a.dart (assed id). This is implemented with @Native() external functions, where you can specify the asset id of the asset, in which the function can be found (#49803). To be able to load other asset types, there need to be different APIs that can load assets using asset ids.

One solution is to add a new Asset class (or Resource) that accepts an asset id and can load the asset similar to a File.

@dcharkes

@mosuem
Copy link
Member

mosuem commented Mar 14, 2024

That is indeed WIP, see https://dart-review.googlesource.com/c/sdk/+/351140. Basically, we need to provide an Asset interface similar to the one in Flutter, and implement where the assets would be stored when running commands such as dart build.

@lrhn lrhn added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Mar 14, 2024
@Dampfwalze
Copy link
Author

Oh, I did not see that. This is good news then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

3 participants