dart_cpp_bridge 1.3.0 copy "dart_cpp_bridge: ^1.3.0" to clipboard
dart_cpp_bridge: ^1.3.0 copied to clipboard

Dart ↔ C++20 bridge (FRB-like). Dart FFI session layer; Native Assets build hooks for Android, iOS, Linux, macOS, and Windows.

dart_cpp_bridge #

pub package

Dart/Flutter ↔ C++20 binding generator, inspired by flutter_rust_bridge.

Write normal C++ code and call it from Dart/Flutter, with sync, async, stream, and Dart-closure reverse calls.

What's this? #

  • Write plain C++20 functions and classes — no hand-written FFI boilerplate
  • Codegen generates Dart API + C++ wire dispatch from annotated headers
  • Built-in runtime based on Asio + async-simple coroutines
  • Supports Android, iOS, Windows, Linux, and macOS

Quickstart #

See the documentation for a complete quickstart:

Show me the code #

C++

#include <dart_cpp_bridge/annotate.h>

BRIDGE_SYNC int32_t add(int32_t a, int32_t b) { return a + b; }

BRIDGE_ASYNC
async_simple::coro::Lazy<std::string> greet(std::string name) {
  co_return "Hello, " + name;
}

Dart

import 'package:my_app/src/native_gen/api/api_fn.dart';

void main() async {
  await DcbLib.init();

  print(add(a: 1, b: 2));            // 3
  print(await greet(name: 'World')); // Hello, World
}

Documentation #

Acknowledgments #

  • Flutter Rust Bridge — architecture and product shape inspiration
  • Asio — event loop and asynchronous I/O
  • async-simple — C++20 coroutine runtime
  • concurrentqueue — lock-free concurrent queue
  • Dart / Flutter team — FFI, Isolate, NativeFinalizer, and the broader Dart native ecosystem

License #

MIT — see LICENSE.

0
likes
150
points
827
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Dart ↔ C++20 bridge (FRB-like). Dart FFI session layer; Native Assets build hooks for Android, iOS, Linux, macOS, and Windows.

Homepage
Repository (GitHub)
View/report issues

Topics

#ffi #native #interop #cpp

License

MIT (license)

Dependencies

code_assets, ffi, hooks

More

Packages that depend on dart_cpp_bridge