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

Remove the dependency of Flutter #9

Closed
rainyl opened this issue Mar 20, 2024 · 4 comments
Closed

Remove the dependency of Flutter #9

rainyl opened this issue Mar 20, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@rainyl
Copy link
Owner

rainyl commented Mar 20, 2024

Actually, Flutter is NOT necessary for this package, it was included just because Flutter is required for dlls to be correctly included for a flutter app, similar to onnxruntime

Native Assets is a better solution, I have tried to use it but without success, I need to customize the build process and use cmake to correctly build opencv and opencv_dart, but the documentations of Native Assets is really insufficient and the feature is not mature.

So, for a pure dart project, it is not suitable to make Flutter as dependency, maybe we should explore more about Native Assets, or another package for pure dart. Or, maybe this is not important, afterall, it seems nearly all of dart users just use it to develop flutter app.

@rainyl rainyl added enhancement New feature or request help wanted Extra attention is needed labels Mar 20, 2024
@SageMik
Copy link

SageMik commented Apr 15, 2024

Thanks for your great work! I have been struggling with generating OpenCV Flutter library via FFI until I found your project, which has inspired me a lot.

For this issue, maybe sqlite3.dart, a pure-Dart database package on which drift depends could help you.
It separates the implementation of FFI bindings and native libraries, so users can provide their own native libraries. For example, in Flutter, we can use sqlite3.dart to call FFI bindings and sqlite3_flutter_libs package to load native libaries, and in Android the latter uses sqlite-native-libraries which builds sqlite via CMake.

I think it's a great layered design and hope it's helpful to you.

@rainyl
Copy link
Owner Author

rainyl commented Apr 15, 2024

Thanks for your approval and suggestions.

I used to consider splitting to different packages, just like OpencvSharp, but pub.dev limits the maximum size of packages to 100M, so for some platforms like android, several .so in a package will exceed the limitation, and it will be laborious if I have to publish 4 and even more packages every time a new version is released.

Actually, I have started working on Native Assets dart-lang/sdk#50565, it is not stable enough, but I have managed to make it work for pure dart and flutter on windows, but for android and ios there are still some problems.

Anyway, thanks for your suggestions, but I think Native Assets will be the best solution in the future, although it's not stable enough for now, I decide to work more on it. If you are interested, contributions are welcome!

@rainyl
Copy link
Owner Author

rainyl commented Apr 16, 2024

Native-Assets build test

For now, main channel required

flutter channel main && flutter upgrade

Tested on Flutter 3.19.6 and above

Worked: Windows, Linux, Android
For ios: build to app success but not tested on real devices

@rainyl
Copy link
Owner Author

rainyl commented Oct 23, 2024

This issus is resolved by new dartcv4 package, closed.

@rainyl rainyl closed this as completed Oct 23, 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
Projects
None yet
Development

No branches or pull requests

2 participants