Backyard

Spawn an abstraction of a permanent isolate called Backyard on which you can execute arbitrary functions - and they are running on a separate thread. This is useful since spawning an isolate still takes 15+ ms and the average latency of passing a function back and forth through Backyard is around 1ms.

    final backyard = Backyard();

    // initialise backyard (takes around 15ms)
    await backyard.init();

    // executes an arbitrary function (takes 1ms)
    final result = await backyard.execute<int>(() => 1 + 2); // returns 3

Libraries

backyard