parmesan 0.1.0 copy "parmesan: ^0.1.0" to clipboard
parmesan: ^0.1.0 copied to clipboard

CLI tool to scaffold Flutter + C++ FFI projects

Parmesan #

[Parmesan]

CLI tool to scaffold Flutter + C++ FFI projects.

Features #

  • Module management — Add C++ modules with auto-generated headers, bridge code, and Dart FFI bindings
  • Cross-platform builds — Add Windows and Linux platform support with CMake configuration (macOS not supported)
  • Automatic binding generation — Parse C++ headers and generate dart:ffi bindings

Prerequisites #

  • Dart SDK >=3.11.5
  • Flutter SDK
  • C++ compiler (MSVC for Windows, GCC/Clang for Linux)
  • CMake

Platform Support #

Platform Supported Notes
Windows Yes MSVC compiler, CMake
Linux Yes GCC/Clang compiler, CMake
macOS No macOS requires C++ code to be built within Xcode IDE. Parmesan's CLI-based workflow is not compatible with macOS's build requirements.

Usage #

Parmesan is designed to be used as a dev dependency in your Flutter project. This keeps the tool versioned alongside your project code and avoids global installation issues.

Step 1: Install as a dev dependency #

flutter pub add --dev parmesan

This adds Parmesan to your pubspec.yaml under dev_dependencies. It is only needed during development to generate code — it is not shipped with your app.

Step 2: Add platform support #

dart run parmesan add:platform windows
dart run parmesan add:platform linux

This scaffolds the C++ bridge files (src/bridge/bridge.h, src/bridge/bridge.cpp) and injects the necessary CMake configuration into your Flutter project's platform runner. Run this once per platform you want to target.

Note: Run add:platform before adding modules so the bridge infrastructure is in place.

Step 3: Add C++ modules #

dart run parmesan add:module my_module --functions "int32_t compute(int32_t x),void process()"

This creates a new C++ module under src/my_module/ with a header and implementation file. You can then open these files and write your C++ logic.

Omit --functions to enter function signatures interactively:

dart run parmesan add:module my_module

Options:

  • -f, --functions — Comma-separated function signatures
  • -p, --path — Path to the project (default: current directory)

Convention: All functions exposed to Dart must be declared with MODULE_EXPORT in the module's header file (.h). The generate:bindings command only scans header files.

Step 4: Generate Dart FFI bindings #

dart run parmesan generate:bindings

This scans all modules in src/, regenerates the bridge files, and creates a single Dart bindings file at lib/bindings/parmesan_bindings.dart. Run this every time you change your C++ module headers so the Dart side stays in sync.

Options:

  • -l, --library — Native library name (auto-detected from pubspec.yaml)
  • -p, --path — Path to the project (default: current directory)

Import the generated bindings #

import 'package:your_project/bindings/parmesan_bindings.dart';

The generated file exposes Dart functions that directly call your C++ code through FFI.

Running Tests #

dart test

License #

MIT

1
likes
0
points
153
downloads

Publisher

unverified uploader

Weekly Downloads

CLI tool to scaffold Flutter + C++ FFI projects

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

args, path

More

Packages that depend on parmesan