Targets · Dart · Native modules

Native modules

The hand-written, per-platform code behind NATIVE functions.

Contents

How a Program becomes Dart, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.

Hand-written Dart behind NATIVE

A function's hand-written dart NATIVE body is dropped in where the function is called, wrapped so its inputs arrive as plain Dart values.

static ReactiveValue<double> Add(dynamic a, dynamic b) {
  return Reactive.Calculate<double>(() {
    final a = Reactive.Value<double>(__reactive_a);
    final b = Reactive.Value<double>(__reactive_b);
    return a + b;                  // the dart NATIVE body
  });
}

As on JavaScript, the drivers are native code too — the Flutter interface driver, animation and network live in their modules' native Dart — and the runtime (Reactive, Context) is itself a native module the rest builds on.