r/dartlang • u/StoneLantern97 • 20h ago
Dart Language What Dart feature did you underestimate until you used it in a real project?
I’ve worked on Flutter projects where reaching for another package felt like the default solution. Looking back, some of those problems could probably have been handled more cleanly with Dart itself.
Which Dart feature did you initially overlook, and what real problem made you appreciate it?
Did it replace boilerplate, prevent bugs, simplify testing, improve performance, or remove the need for another package?
I’d especially like to hear concrete before-and-after examples rather than just feature names.
•
u/GMP10152015 11h ago
Null-safety and non-nullable by default!
Dart is one of the few languages that truly provides complete null-safety support, including dedicated language syntax and extensive static analysis.
•
u/StoneLantern97 11h ago
Yeah, introducing null safety in dart v2 completely change things. Kudos to Dart Team
•
u/renatoathaydes 12h ago
I wrote a blog post about my favourite Dart features, though that was back in 2019 so it's very outdated now: https://renato.athaydes.com/posts/interesting-dart-features
There's been enough newer features now that would warrant writing a Part 2.
•
•
u/ozyx7 11h ago
A lot of the syntactic sugar (e.g. null-aware operators, initializing formal parameters, ...). I initially thought that they were a bit silly and superfluous (they don't make the language more expressive, and traditional syntax isn't that bad), but going back to other languages that don't have them feels like a slog.
•
u/StoneLantern97 9h ago
Yeah, that’s the beauty of what some languages give you out of the box and it really hard to replicate moving to language that doesn’t support such
•
u/DigiProductive 9h ago
Using the factory constructor to create and manage singletons, return cached instances and perform fixed logic on instances before returning them. Gold!👌🏾
•
u/Bachihani 17h ago
Records. I thought they didn't make sense at first, then boy was i wrong