https://github.com/doo/flutter_ffi_demo
a demo project of flutter native interactions through dart:ffi
https://github.com/doo/flutter_ffi_demo
Last synced: 12 months ago
JSON representation
a demo project of flutter native interactions through dart:ffi
- Host: GitHub
- URL: https://github.com/doo/flutter_ffi_demo
- Owner: doo
- License: other
- Created: 2021-10-19T09:47:49.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-12T16:29:25.000Z (over 3 years ago)
- Last Synced: 2025-05-08T03:34:06.608Z (about 1 year ago)
- Language: C
- Size: 32.6 MB
- Stars: 8
- Watchers: 8
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Readme
This is example project of how to use opencv with flutter::ffi utilities based on the tutorial in the blog post:
["Implementing a Flutter plugin with native OpenCV support via dart::ffi – Part 1"](https://scanbot.io/blog/implementing-a-flutter-plugin-with-native-opencv-support-via-dartffi-part-1-2/)
["Implementing a Flutter plugin with native OpenCV support via dart::ffi – Part 2"](https://scanbot.io/blog/implementing-a-flutter-plugin-with-native-opencv-support-via-dartffi-part-2-2/)
## Preparation
### Install the latest cmake (minimum version is 3.21.1)
```bash
brew install cmake
brew unlink cmake && brew link cmake
```
### Add additional global params to you rc file
```bash
export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle
export ANDROID_NDK=$ANDROID_NDK_HOME
export NDK=$ANDROID_HOME/ndk/23.0.7599858
```
Here 23.0.7599858 could be any version > 23.0.75..
### Don't forget to switch you console to the new source!!
## Prebuild opencv for both platforms
This will take some big amount of time cause we need to build opencv for ios and android for ALL architectures
```bash
cd src
sh prebuild.sh
```
### For ios also need to call build.sh from the ios folder
This script will prepare ios `framework` file that will contain all c++ code. It also should be applied each time you change c++ code and need to check it or iphone
```bash
cd src/ios
sh build.sh
```