Personal project · May 2025
ScanNutrition
A Flutter nutrition scanner with image processing delegated to native C++ through dart:ffi.
- Problem
- Real-time image processing for scanning is too expensive for Dart — but rewriting the whole app natively would be absurd.
- Outcome
- A cross-platform Flutter interface with an image-processing pipeline in C++ called through dart:ffi.
- Role
- Mobile developer
What problem does ScanNutrition solve?
Scanning a nutrition label processes several frames a second: conversion, thresholding, perspective correction. Done in Dart, the video feed stutters.
What technical decision was made?
Move only the computation kernel to C++, not the application. dart:ffi calls native code without going through platform channels — therefore without serialisation or an asynchronous round trip, which is precisely the cost we are trying to avoid.
The boundary sits in exactly one place: a function that takes an image buffer and returns a processed buffer. Everything else — camera, interface, state — stays in Dart.
Compilation through CMake, one pass per platform, wired into the Flutter build.
What did ScanNutrition teach me?
An FFI boundary is paid for in build complexity. It is worth it under one condition only: that the native code is a pure function over a buffer. The moment it holds state, the complexity spills over.
A project of the same calibre ?
Based in Thiès, available in dakar & remote. I reply within 48 hours.
Let's talk