← Back to Projects
Cross-Platform

Recipe Vault

Offline-first Flutter recipe & shopping list app backed by a C++20 dart:ffi engine

FlutterDartC++20dart:ffiSQLite (sqflite)CMake
C++20 via dart:ffiNative Core
Offline SQLitePersistence
Density-AwareConversions

Problem & Constraints

Scaling recipes and merging ingredients into a single grocery list gets messy fast when recipes mix volume and weight units (such as cups, tablespoons, ounces, and grams) across ingredients with different densities. I built RecipeVault as an offline-first mobile app that delegates unit parsing, scaling, and density-aware conversion to a portable C++20 backend rather than duplicating fragile conversion logic in UI code.

Architecture & Tradeoffs

Interop & Memory Ownership Pattern

Keeping the native interface strictly C-compatible and explicitly defining pointer ownership prevents subtle leaks across release builds:

// native/unit_converter.h
extern "C" {
  struct ConversionResult {
    double value;
    int32_t status_code;
  };

  ConversionResult rv_convert_unit(
      double amount,
      int32_t from_unit_id,
      int32_t to_unit_id,
      double grams_per_ml);
}
// lib/native/unit_bridge.dart
final class ConversionResult extends Struct {
  @Double()
  external double value;

  @Int32()
  external int statusCode;
}

typedef _NativeConvert = ConversionResult Function(
  Double amount,
  Int32 fromUnitId,
  Int32 toUnitId,
  Double gramsPerMl,
);

typedef _DartConvert = ConversionResult Function(
  double amount,
  int fromUnitId,
  int toUnitId,
  double gramsPerMl,
);

Debugging & Packaging Win