A Flutter plugin that uses FFI to access libphonenumber.
This plugin works out of the box.
- The static library will be stripped in release mode. Follow this to prevent.
- This library does not support
armv7
andarmv7s
. Therefore, you need to configure the build target to support only arm64.- Open iOS project in XCode.
- Go to
Target Runner > Build Settings > Architectures
- Set the
Architectures
fromStandard Architectures (arm64, armv7)
toarm64
.
This plugin does not support all the features from the Google libphonenumber. You can file an issue and I will work on it. Alternatively, you can also create a PR to contribute.
Download NDK (version 22.0.7026061) from Android Studio SDK manager.
Set Android NDK environment:
export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export ANDROID_NDK_HOME=/Users/$USER/Library/Android/sdk/ndk/24.0.8215888
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK_HOME
Change the working directory to dr_libphonenumber/native/dr_libphonenumber
:
Run the following commands to get started.
make init
The command above installs all the dependencies required by the machine to build the static libraries.
Next, run
make all
It generates all the static libraries.
Check here for the rest.
- Run
brew install llvm
to installllvm
. - Run
brew list llvm
to locate thellvm
. - Add the path to
ffigen_config.yaml
.
The processes above are for initial setup. The following are subsequent steps for updating the Rust code.
- Change working directory to
native/dr_libphonenumber
. - Run
make all
.
- Run
flutter pub run ffigen --config ffigen_config.yaml