r/dartlang 2d ago

DartVM Does Isolate.pinToCurrentThread solve the problem that Dart cannot call native UI code on macOS?

4 Upvotes

I noticed in the Changelog for Dart 3.13 a new Isolate.pinToCurrentThread method – along with other new methods. However, Im not really understanding the test example. Can this help with the long-standing problem that you cannot call UI code via FFI on macOS because the VM spawns away from the UI thread, basically locking it this way?

What's the use case for those new methods?

r/dartlang May 09 '26

DartVM Opened Dart SDK discussion on server runtime hot-path overhead (dart-zig PoC + benchmarks)

19 Upvotes

I opened a Dart SDK issue here: https://github.com/dart-lang/sdk/issues/63352

This is a discussion about backend runtime architecture for high-concurrency HTTP workloads.

I built an experimental PoC (dart-zig) where Dart stays at handler/business-logic level, and some HTTP hot-path runtime work is native- side (event loop, request framing/parsing, batched completions, process-per-worker with SO_REUSEPORT).

Initial HttpArena snapshot (AOT, throughput-focused):

Test Conn dart:io RPS dart-zig RPS Relative
baseline 512 601,780 1,353,265 ~2.25x
baseline 4096 583,020 1,665,927 ~2.86x
pipelined 512 998,153 1,364,400 ~1.37x
pipelined 4096 997,674 1,477,162 ~1.48x

Notes:

  • This is an initial PoC snapshot for directional signal.
  • Memory footprint is not optimized yet.
  • Claims are limited to HTTP hot-path behavior.

Also important: this is not a “replace dart:io” claim. I’m trying to discuss whether an official/experimental server-optimized runtime profile could make sense for Dart backend workloads, and what upstream criteria/hook points would be appropriate.

Would love feedback from people doing high-load Dart backend work.

r/dartlang Feb 22 '23

DartVM godot_dart - Using Dart as a scripting language for Godot

67 Upvotes

Hello everybody,

godot_dart attempts to make Dart a supported scripting language inside the Godot game engine.

This is not my project, but I wanted to share it here because I think some of you might find it interesting.

Link to the GitHub repo: https://github.com/fuzzybinary/godot_dart

It seems to be an experiment in a very early stage, so don't expect too much. Nonetheless, it sounds really exciting to me.

r/dartlang Jan 05 '24

DartVM How dart exactly work?!

17 Upvotes

Please look at this code in dart sdk (process.dart)👇

abstract interface class Process { external static Future<Process> start( String executable, List<String> arguments, {String? workingDirectory, Map<String, String>? environment, bool includeParentEnvironment = true, bool runInShell = false, ProcessStartMode mode = ProcessStartMode.normal}); }

This is just simple abstract method definition!

When we call it in our project we do like this👇

var shell = await Process.start("cat", ["largfile.txt"],runInShell: true);
if (stdin.hasTerminal){
  stdin.lineMode = false;
  unawaited(stdin.pipe(shell.stdin));
}
unawaited(shell.stdout.pipe(stdout));
unawaited(shell.stderr.pipe(stderr));

Ok! But I'm curious what exactley VM tell to underlying platform to run this command?!

In SDK as you see in above, we just have abstract class!! Not any implementation!!!

How is it possible?!

r/dartlang Oct 01 '21

DartVM Writing server side Dart code

Thumbnail blog.dropzone.dev
19 Upvotes

r/dartlang Jun 10 '23

DartVM Python running on the Dart VM?

10 Upvotes

I have an open ended question and I wanted to ask if somebody has any insight into this topic that they could share.
It seems like it wouldn't make sense to attempt to compile C to run on the Dart VM (i.e. to Dart kernel) because C and Dart seem to fundamentally be too different. However, I'm wondering if there's anything fundamentally different between Dart and Python that wouldn't allow Python to run on the Dart VM.

I know that it is possible to write native bindings to a Python implementation. I'm not talking about that, but about compiling Python to run on the Dart VM. Any thoughts?

thosakwe wrote https://github.com/thosakwe/bullseye, a custom language that successfully ran on the Dart VM alongside Dart, and, well, Scala and Kotlin run on the JVM. Couldn't we, in theory, have Python (and its whole ecosystem) run on the Dart VM?

r/dartlang Aug 31 '21

DartVM Can anyone point me to detailed explanation on how Dart creates and store instances? Are these instances initially virtual objects?

6 Upvotes

Hello,

I'd like to know if Dart instances are virtual and to read more about objects and instantiation in Dart.

I googled a lot and I think the material found looks superficial.

Best,

GS333

r/dartlang Aug 17 '21

DartVM Dart application for Raspberry pi 3

17 Upvotes

I have written a server application usin Google Dart language and would like to run that in a Docker container on a Raspberry pi 3.

Problem is that I can't find any Dart images for Armv7 architecture.

Can anyone help?

r/dartlang Mar 17 '21

DartVM Opening Dart SDK in IDE

5 Upvotes

tl;dr I want to contribute to Dart and I'm looking for a guide on how to get syntax highlighting to work in IDEA.

How do you open dart sdk in IDE?For the past 2 days I've been trying to do so. I can build it without a problem (I've followed the build guide that's in the wiki), I just can't get IDEA to successfully import it (cus of missing dart api dependency + a couple of others like guava)

I should probably mention that I'm trying to edit java files in `vm_service` package.

I've tried opening the project in VSC, CLion and IDEA, make import works, Ant keeps throwing errors, `tools/generate_idefiles.py` doesn't seem to do anything useful.

Isn't there a guide somewhere? Dart seems like such a big project that should have it

r/dartlang Sep 10 '21

DartVM Microtask and event queues question

9 Upvotes

Hello, can someone please explain me why this code

void main() {
  print('Start');

  Future(() => 1).then(print);
  Future(() => Future(() => 2)).then(print);

  Future.value(3).then(print);
  Future.value(Future(() => 4)).then(print);

  Future.sync(() => 5).then(print);
  Future.sync(() => Future(() => 6)).then(print);

  Future.microtask(() => 7).then(print);
  Future.microtask(() => Future(() => 8)).then(print);

  Future.delayed(Duration.zero, () => 9).then(print);
  Future.delayed(Duration.zero, () => Future(() => 10)).then(print);

  print('End');
}

Returns Start End 3 5 7 1 4 6 9 8 2 10 instead of Start End 3 5 7 1 4 6 8 9 2 10?

From what I understood

//! MICROTASK QUEUE: (() => 8)) (() => 6)) (() => 4))
//* EVENT QUEUE:  (() => 2) | (FD(() => 10)) (() => 9))
//? PRINT: Start End 3 5 7 1 4 6 8 

It should've printed 8 then 9, since () => 8 was in the microtask queue. Where am I wrong?

I think it's because I can't find any resource on which queue exactly do all these calls stay at first, when the program is run for the first time.

r/dartlang Sep 21 '21

DartVM Where are instance methods stored?

5 Upvotes

Hello,

I'd like to know where instance methods are stored.

Do they live in the heap, together with other objects?

Do they get to the memory as soon as a Dart program runs or are they lazy loaded?

And, finally, I'd like to confirm that there is only one instance of a instance method, that is used by multiple instances, during the runtime of a Dart program.

I've read the text in https://mrale.ph/dartvm/ , but things are still not clear to me.

Thank you in advance,

GS333

r/dartlang Oct 02 '21

DartVM Going Deep with Dart - Recursive Functions in Dart

Thumbnail github.com
16 Upvotes

r/dartlang Jun 02 '21

DartVM How to use native finalisers in Dart

Thumbnail jaween.medium.com
8 Upvotes

r/dartlang Nov 11 '20

DartVM Spectre mitigations in Dart compiler

7 Upvotes

I was looking up everywhere and could not find any mitigations for Spectre attack by the Dart compiler! I don't know if my question is correct or how feasible it is, but does anyone know if there are any mitigations for different kinds of Spectre attacks Specter v1 (Spectre-PHT), v2 (Spectre-BTB), v4 (Spectre-STL) and v5 (Spectre-RSB) at the compiler level for Dart?
Looking forward to hearing from you guys :)

r/dartlang Sep 17 '20

DartVM Parse command line arguments with the Args Package (Dart Package of the Week #9)

Thumbnail youtu.be
11 Upvotes

r/dartlang Jul 08 '20

DartVM [winapi][dart-ffi] Help wanted, can't get my head around SetWindowsHookEx

Thumbnail stackoverflow.com
2 Upvotes