Skip to content
pubscout

irondash_message_channel

0.7.0, released 3 years ago by irondash.dev

Rust-to-Dart bridge mimicking Flutter's platform channel via FFI without code generation.

$ flutter pub add irondash_message_channel
Source repository

What it does

Provides a platform-channel-like interface for bi-directional communication between Dart and Rust code. It uses Dart FFI to allow high-performance message passing with zero-copy binary transfers from Rust to Dart. It handles thread affinity, async calls, and Dart garbage collection finalizers without requiring code generators.

AI-written summary of version 0.7.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Building a Flutter application backed by custom Rust native code.
  • Seeking a platform-channel style API for Rust interop instead of manual low-level FFI bindings.
  • Transferring binary data between Rust and Dart where zero-copy or minimal-copy performance is critical.

Skip it when

  • Not using Rust in your project.
  • Needing web platform support (limited to native desktop and mobile platforms via FFI).
  • Projects that prefer automated Dart/Rust binding generation like flutter_rust_bridge.

Strengths

  • Zero-copy transfers for binary data from Rust to Dart.
  • Familiar platform channel API on the Dart side.
  • No Dart code generation required to set up communication.

Weaknesses

  • Requires manual Rust setup and companion Rust crate configuration.
  • Background thread channels require managing a custom RunLoop in Rust.

Setup

Kind
FFI (native library)
Effort
Medium
Code generation
No
Direct dependencies
1

Requires compiling a companion Rust dynamic library (.so, .dll, or process) and setting up an FFI initialization function entry point.

final nativeContext = _initNativeContext();
final channel = NativeMethodChannel('my_method_channel', context: nativeContext);

channel.setMessageHandler((call) async {
  if (call.method == 'myMethod') {
    return 'myResult';
  }
  return null;
});

final res = await channel.invokeMethod('someMethod', 'someArg');

Alternatives

Packages that do the same job and could replace irondash_message_channel.

  • cli_completion

    Completion functionality for Dart Command-Line Interfaces built using CommandRunner.

  • cli_tools

    Utilities for building command‑line interfaces, including argument parsing, analytics, and progress reporting.

  • secretary

    A Dart library for managing queues of asynchronous tasks with validation, retries and event streams.

  • filterator

    A powerful API query builder for constructing structured queries with filtering, ordering, and pagination.

Works with

Packages commonly used together with irondash_message_channel: ones it builds on, ones built on it, and its own family.