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 Dart Extensions #2396

Closed
eseidelGoogle opened this issue Mar 3, 2016 · 11 comments
Closed

Support for Dart Extensions #2396

eseidelGoogle opened this issue Mar 3, 2016 · 11 comments
Assignees
Labels
c: new feature Nothing broken; request for a new capability

Comments

@eseidelGoogle
Copy link
Contributor

https://www.dartlang.org/articles/native-extensions-for-standalone-dart-vm/

We've had at least one request for this. I suspect it's implemented entirely in the dart CLI.

My understanding is it's just a bit of code to map dart-ext: urls to making a dlopen call and passing the symbols off to the VM. @johnmccutchan

I'm mostly seeking to document how we'd do this in this bug. It's not clear if this is generically useful.

@eseidelGoogle eseidelGoogle added this to the Flutter 1.0 milestone Mar 3, 2016
@eseidelGoogle
Copy link
Contributor Author

@johnmccutchan johnmccutchan self-assigned this Mar 3, 2016
@johnmccutchan
Copy link
Contributor

Assuming we keep this in the embedder, what happens when an import 'dart-ext:' occurs is the following:

  1. Load the .so/.dll
  2. Invoke the extensionName_Init() method.

In existing extensions, in the _Init method mostly just wires up the native resolver for the Dart code.

I wonder if we could formulate extensions differently and support them directly in the VM. I'll investigate this.

@Hixie Hixie added the c: new feature Nothing broken; request for a new capability label Mar 6, 2016
@johnmccutchan
Copy link
Contributor

@Hixie Hixie modified the milestones: Flutter 2.0 or later, Flutter 1.0 May 26, 2016
@Hixie
Copy link
Contributor

Hixie commented May 26, 2016

I've moved this to the 2.0 milestone since it doesn't seem like a blocker for a quality first release.

@eseidelGoogle
Copy link
Contributor Author

This is not needed by any near-term customer. The only bug I've seen which might use this is opengl support: #179 iceboxing.

@nacardin
Copy link

I'm currency working on an app that needs to use digital signatures, specifically EdDSA. Since there are C implementations which are stable and known to be reliable, I think it would be safer to use FFI, rather than trying to port the algorithm to dart.

Especially with WebAssembly becoming widely supported, Flutter would be at a disadvantage if it didn't allow FFI to use native libraries.

@sethladd
Copy link
Contributor

You may be able to use our plugins system to communicate between the Flutter Dart code and platform-specific libraries: https://flutter.io/platform-plugins/

@eseidelGoogle
Copy link
Contributor Author

#7053 is probably what you want. You can integrate with C code today with Flutter, you just have to bounce through Java/Obj-C first.

@eseidelGoogle
Copy link
Contributor Author

This need will hopefully be covered by FFI work: dart-lang/sdk#34452 and related tooling work in: #7053

@ping996
Copy link

ping996 commented Oct 21, 2019

does the flutter support dart native extension? according to use import 'dart-ext:library_name';
https://dart.dev/server/c-interop-native-extensions

TahaTesser pushed a commit to NevercodeHQ/flutter that referenced this issue Aug 13, 2020
When all plugins are release at once there will be a tag for each of the plugins but each tag will again test all plugins which makes it not optimal.
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: new feature Nothing broken; request for a new capability
Projects
None yet
Development

No branches or pull requests

6 participants