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

Support for @Native #1849

Open
Dampfwalze opened this issue Apr 1, 2024 · 2 comments
Open

Support for @Native #1849

Dampfwalze opened this issue Apr 1, 2024 · 2 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@Dampfwalze
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Darts (experimental) native assets feature abstracts away the resolution and loading of binaries. They can be resolved using an asset id with the new @Native API:

@Native<Int64 Function(Int64, Int64)>('sum', asset: 'mylib/mylib')
external int sum(int a, int b);

flutter_rust_bridge still uses DynamicLibrary to load functions, which will not receive support for resolution of native assets, as described by dart-lang/sdk#49803 (comment).

Describe the solution you'd like

Regarding the eventual goal of native assets being one of the main methods to bundle binaries, I propose to generate bindings using @Native instead of DynamicLibrary. Maybe first behind an experimental feature.

Describe alternatives you've considered

There is currently no way to accurately resolve a shared library, bundled with native assets, in every scenario.

@Dampfwalze Dampfwalze added the enhancement New feature or request label Apr 1, 2024
@fzyzcjy
Copy link
Owner

fzyzcjy commented Apr 2, 2024

Sure! Indeed when developing the initial version of v2, I do think about this. However, it was (and still is?) experimental. Therefore, I want to wait a little bit until it is stablized. Or, do you have reasons to do it now (I am happy to hear!)?

There is no need to worry as an end user: This is just implementation details of flutter_rust_bridge, and when it is switched to the new API, users usually do not need to change things, and flutter_rust_bridge will just generate new code.

Copy link

stale bot commented Jun 1, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants