Urgent.News

What's breaking now, across thousands of outlets.

Tech

Talking to Native: FFI, Pigeon, and Knowing Which One You Need

A MethodChannel typo cost us three days and a hotfix release, and the compiler never said a word. That's the whole story of Flutter native interop in one sentence: the easy path is a stringly-typed message bus that fails silently in the field, and almost everyone reaches for it first. Every Flutter developer's first brush with native code goes the same way. You need something the framework…

Flutter provides three ways to interoperate with native code: dart:ffi, Pigeon, and raw MethodChannel. These methods are not interchangeable, and picking the wrong one leads to pain in the long run.

dart:ffi is the fastest path and allows calling C, Rust, or any other language with a C ABI directly, synchronously, and with zero serialization. Pigeon is a code generator that creates type-safe method channels for you, using the same transport as raw channels but with compiler checks on both sides. Raw MethodChannel/EventChannel is a manually-built message bus between Dart and the platform, which is asynchronous, dynamically typed, and requires manual handling on both ends.

FFI is meant for calling existing native functions, Pigeon is for working with platform APIs and getting a typed contract, while raw channels are for event streams and plugins that Pigeon can't handle yet. The key decision is between FFI and Pigeon, with raw channels being a fallback for specific cases.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Msaada: Turning Community needs into Practical Support

This is a submission for Weekend Challenge: Generosity Edition What I Built I built Msaada, a community-powered platform designed to turn local needs into practical, organized support.

  • Msaada is a community-focused platform to turn local needs into organized support.
  • Users can create needs, specifying details like category, location, urgency, and funding goals.

What Actually Happens When You Round an RGB Triplet to a HEX Code

You can write rgb(255, 99, 71) in a stylesheet, copy it into a designer tool, or paste it into a generator, and you will usually see the same tomato-orange on screen.

  • Input RGB values must be clamped to [0, 255] range
  • Float inputs require correct rounding for consistency
  • RGB is not a single color space, conversions depend on space

10 Developer Tools That Can Save You Time Every Day

As developers, a surprising amount of time is spent on small tasks. Formatting JSON, encoding Base64, generating hashes, decoding JWTs, testing regular expressions, converting timestamps — none of…

  • MazdaDev streamlines developer tasks by combining utilities into one workspace.
  • Offers JSON Formatter, Base64 Encoder/Decoder, JWT Decoder, and more.
  • 7-day Pro trial available to test tools and features.

More from Saturday 5 September →