firstfloorsoftware / flutter_sodium

Flutter bindings for libsodium
BSD 3-Clause "New" or "Revised" License
102 stars 46 forks source link

Use Dart VM FFI #12

Closed kozw closed 4 years ago

kozw commented 5 years ago

The Flutter 2019 roadmap lists better support for C/C++ libraries from Flutter, including direct calls to C/C++ from Dart. This is of major importance for flutter_sodium. The current implementation uses platform channels with Java and Swift interop.

Not only is the runtime performance sub-optimal, there's a lot of code to write and maintain. Not to mention the fact that the Android version is still lacking in features compared to iOS due to a dependency on incomplete 3rd party libraries (#7)

As soon as native C interop is available, flutter_sodium should take advantage of it. You can track the Dart issue and read more in the FFI vision document. Looks like an initial version is planned somewhere in Q1 2019.

filleduchaos commented 4 years ago

Hello @kozw - is there any work being done on this now that dart:ffi is in preview? I see there's an ffi branch, but it hasn't been touched in 6 months. I'm open to contributing if you're short on time/resources :)

kozw commented 4 years ago

Not at the moment no, indeed due to limited time and resources. I'm not sure the current ffi branch even compiles with the latest preview bits. Feel free to start creating pull requests.

cbenhagen commented 4 years ago

@kozw Maybe you could team up with Marvin Hannot? (https://gitlab.com/MagicGuitar/dart-sodium)

MarvinHannott commented 4 years ago

As far as I know, the FII doesn't work (yet) with AOT compilation. And calls aren't asynchronous like calls to Flutter's MethodChannel. But if you think my work is of any help, please feel free to use it.

cbenhagen commented 4 years ago

FFI does now work with AOT. See https://github.com/dart-lang/sdk/issues/35765 and https://github.com/dart-lang/sdk/issues/37295.

canewsin commented 4 years ago

@cbenhagen is there any documentation on usage ?

kozw commented 4 years ago

Porting flutter_sodium to FFI has recently been started. Track its progress in #35. Closing this issue