r/dartlang

Dart VM + analyzer + compiler with stateful hot reload in the browser via WebAssembly.

Hello everybody 👋 ,

I managed to compile the Dart VM, runtime, compiler & analyzer to WebAssembly and it runs in the browser! It also supports hot reload and you can invoke and hot reload functions by clicking a button in the editor and state is preserved!

It's crazy fast, compiling and analyzing is instant because there's no server communication like with DartPad.

It's essentially a single static page (7.6 MB gzipped) runs on the iPad, iPhone, Mac, everywhere!

Here's the github repo: https://github.com/modulovalue/dart-live

modulovalue.github.io
u/modulovalue — 1 day ago
▲ 17 r/dartlang+2 crossposts

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

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.

u/Only-Ad1737 — 4 days ago

I implemented a Dart code generator for Skir, a modern alternative to Protobuf

The goal is to make it easy to share data between a Dart/Flutter application and an application written in another language (one of the 12 languages that Skir supports).

I would love to hear what the Dart community thinks of it.

skir.build
u/gepheum — 3 days ago

Raylib Dartified (not just another boring ffigen wrapper)

~98% of the full Raylib 5.5 API completely Dartified (+ optional Raygui support).

Instead of dumping raw ffigen output and calling it a day, this is a hand-crafted, layered approach: a thin raw FFI layer underneath, and a proper Dart-idiomatic layer on top. Structs feel like Dart objects, memory is managed sensibly, and the API doesn't make you feel like you're writing C with extra steps.

Coverage-wise, this is about as complete as a Raylib wrapper for Dart is going to get right now. There are a large number of ported official examples, both for the raw FFI layer and the higher-level Dart layer, so you can see exactly how everything maps.

The API is approaching stability. Once it settles, the plan is to track Raylib 6.0.

Links:

Of course, nothing is perfect. Testers are welcome, if something is broken, missing, or feels off, open an issue or leave a comment.

u/_XYZT_ — 9 days ago
▲ 13 r/dartlang+2 crossposts

Hey r/dartlang 👋

I just shipped 0.6.0 of two packages that let you expose plain Dart methods as an MCP server, a REST API (with OpenAPI 3.0 spec), or both — from the same annotated class.

What it looks like

    import 'package:easy_api_annotations/easy_api_annotations.dart';
    
    @Server(
      transport: McpTransport.http,
      port: 8080,
      generateRest: true, // also emit .openapi.dart + .openapi.json
    )
    class UserApi {
      @Tool(description: 'Create a new user')
      Future<User> createUser({
        @Parameter(pattern: r'^[\w\.-]+@[\w\.-]+\.\w+$') // optional
        required String email,
        required String name,
      }) async => /* ... */;
    
      @Tool(description: 'Get user by ID')
      Future<User> getUser({required int id}) async => /* ... */;
    }

Run dart run build_runner build and you get:

  • user_api.mcp.dart — a stdio or HTTP MCP server
  • user_api.openapi.dart — a Shelf REST server (POST /users, GET /users/{id})
  • user_api.openapi.json — an OpenAPI 3.0 spec you can feed to Swagger UI

What's in 0.6.0

  • Renamed @Mcp → @Server (the old name still works as a deprecated typedef)
  • Split generation flags: generateMcp, generateRest, generateJson
  • REST template honors @Server(logErrors:) so 500s stay generic client-side but you get full stack traces on stderr when you want them
  • @Parameter(sensitive: true) now actually propagates — x-sensitive in .mcp.json, writeOnly: true + format: 'password' in .openapi.json
  • Code Mode (optional Node.js sandbox for batch tool orchestration)
  • Canonical package:easy_api_generator/easy_api_generator.dart entry point

Working example

Full runnable example (users + todos, stdio + HTTP + REST): https://github.com/cdavis-code/easy_api_workspace/tree/main/example

Happy to hear feedback, bug reports, or "you should really generate XYZ too."

u/unnghabunga — 9 days ago

I am currently weighing dart:web and shelf for a new production-grade web project. Coming from a Java/Spring Boot background, my intuition is leaning heavily toward Dart.

The developer velocity feels significantly higher, and I love that Dart gives me that structured, type-safe Java feel without the heavy boilerplate or the friction of JavaScript.

However, before I commit fully, I would appreciate to hear from those who have actually maintained Dart web or server apps long-term.

Specifically:

  1. Performance at Scale:
    How does shelf handle high-concurrency compared to something like Spring Boot or Go? Are there specific bottlenecks you have hit?

  2. The Ecosystem Gap:
    What are the missing pieces you have encountered? For example, specific DB drivers, middleware, or auth libraries that are not as mature as the Java ecosystem.

  3. Maintenance and Debugging:
    How is the day 2 experience? Are you finding the deployment pipelines and debugging tools, especially for dart:web, to be reliable for production?

  4. The Gotchas:
    Is there anything you wish you knew before moving away from similar traditional stack?
    I am sold on the productivity, but I want to make sure I am not trading off stability or long-term maintainability.

I would appreciate to hear your experiences.

reddit.com
u/kerkerby — 10 days ago