Skip to content

Instantly share code, notes, and snippets.

@espresso3389
espresso3389 / flutter-ffi-async-nativeport.md
Last active April 14, 2025 15:37
Async messaging between Flutter and C++ using Dart ffi NativePort

C++

  • Copy Dart SDK (${FLUTTER_DIR}/bin/cache/dart-sdk/include) to your project, e.g. ios/Classes/
  • Add your own code like the following fragment
#include "dart_api_dl.h"

// Receives NativePort ID from Flutter code
static Dart_Port_DL dart_port = 0;