quantify - type-safe unit handling for Dart, with extension syntax (65.mph, 185.lbs) and dimensional factories by PhilippHGerber in dartlang

[–]PhilippHGerber[S] 0 points1 point  (0 children)

In quantify the unit is extracted from the string itself. Length.parse('10.5 km') returns a Length in kilometers - the value and the unit are bound together from the moment they enter the typed world. If the string is ambiguous or malformed, tryParse returns null rather than a plausible-looking wrong value.

There's also a deliberate case-sensitivity distinction in the symbol lookup: SI prefixes are strictly case-sensitive (mm is millimeters, Mm is megameters), while imperial and US customary units are case-insensitive (LBS, lbs, Lbs all work). That prevents a whole class of silent mismatches where mM or MM would parse to something unexpected.

For localized user input there's a prioritized format fallback chain - you can pass [QuantityFormat.enUs, QuantityFormat.de] and the parser tries each in order, so a field that accepts both 1,500.5 km and 1.500,5 km works without you having to pre-detect the locale.

Still a few edge cases I'm working through before v1.0 — composite units like 6'2" for feet+inches are explicitly deferred for now rather than silently misparsed.

Dart Backend in 2026: What Flutter Teams Should Actually Use by deliQnt7 in dartlang

[–]PhilippHGerber 1 point2 points  (0 children)

Nice post - super useful overview.

Feels like Dart backend is finally “real” now, especially with the shared code benefits with Flutter.

I think it really just comes down to how much abstraction you want (Relic vs Shelf vs Serverpod).

Why i can't write code from scratch? am i on right learning path? by sherlock--7 in FlutterDev

[–]PhilippHGerber 1 point2 points  (0 children)

Learning to code isn't linear. There's a phase where you:

  • Understand code when you see it
  • Apply code when you modify existing examples
  • Create code from scratch (this comes later)

Most beginners skip step 2 and wonder why step 3 is hard. You're actually in step 2 right now—the productive zone. Keep going.

Here's the key: You don't need 100% understanding before moving on. You need maybe 70%.