EOF

Finally, add an externalNativeBuild section to
android/build.gradle. For example:

Step 3: Load the code using the FFI library

In this example, you can add the following code to
lib/native_add.dart. However the location of the
Dart binding code is not important.

First, you must create a DynamicLibrary handle to
the native code. The following example shows
how to create a handle for an iOS app OR an Android app:

Note that on Android the native library is named
in CMakeLists.txt (see above),
but on iOS it takes the plugin’s name.

With a handle to the enclosing library,
you can resolve the native_add symbol:

Finally, you can call it. To demonstrate this within
the auto-generated “example” app (example/lib/main.dart):

Other use cases

Platform library