cnativeapi 0.4.0 copy "cnativeapi: ^0.4.0" to clipboard
cnativeapi: ^0.4.0 copied to clipboard

[pending analysis]

Raw Dart FFI bindings to the nativeapi C API. The native library is built from source by a build hook.

cnativeapi #

Raw Dart FFI bindings to the C API of libnativeapi, generated with ffigen.

This package provides low-level FFI bindings and is typically used as an internal dependency of nativeapi. You generally don't need to depend on it directly.

It is a plain Dart package and does not depend on Flutter. Its build hook (hook/build.dart) compiles the nativeapi core into a shared library whenever a Dart or Flutter app that depends on it is built, and every function is an @Native external bound to that library.

Platform Support #

Android iOS Linux macOS Windows
✅ ✅ ✅ ✅ ✅

Building needs a C++17 toolchain for the target: Xcode on macOS and iOS, the Android NDK, Visual Studio on Windows, and on Linux clang or GCC plus the GTK 3, X11 and Xi development packages (found with pkg-config).

Usage #

import 'package:cnativeapi/cnativeapi.dart';

See example/cnativeapi_example.dart; run it with dart run example/cnativeapi_example.dart.

For higher-level Dart APIs, use the nativeapi package instead.

Regenerating Bindings #

Bindings are generated from the C headers in core/src/capi/. From the repository root:

./codegen

or, for this package alone, ./codegen ffigen (set LIBCLANG_PATH if ffigen cannot find libclang).

License #

MIT

2
likes
0
points
3.5k
downloads

Publisher

verified publisherleanflutter.dev

Weekly Downloads

Raw Dart FFI bindings to the nativeapi C API. The native library is built from source by a build hook.

Homepage
Repository (GitHub)
View/report issues

License

(pending) (license)

Dependencies

code_assets, ffi, hooks, logging, native_toolchain_c

More

Packages that depend on cnativeapi