Ask HN: Pros and Cons of the Dart Language?

4 points by rlawson 5 months ago | 4 comments
I have been working with flutter and have come to really like Dart. I'm primarily a Java dev and to me Dart feels like a lighter Java with better dev experience. I am considering using it in other areas - command line projects, webapps - basically places I would have used Java, Python or Go. What are pros/cons people have found in using Dart outside of the flutter ecosystem?
  • Alifatisk 5 months ago
    Here's the cons from my experience.

    Dart does not cross-compile, it's still an issue to this day and there haven't been any plans to fix that yet from what I can tell. https://github.com/dart-lang/sdk/issues/28617

    Another slight issue I've found is the error message it spits out is kinda unhelpful most of the time, but that issue also applies to Flutter. The stacktrace is like 100 lines with only the five first rows is helpful, the rest is internal code.

    Dart lacks a repl (there is this package called Interactive but it's a hacky solution).

    One last thing I do not enjoy about Dart is that even if the code compiles, you are not guaranteed that the massive refactor you did is "sound", that will say, errors can popup during runtime, so you have to write tests for every part. This is such a bummer because in Java, if I do a large refactor and the linter, ide and compiler is happy, then you will likely be rest assured that the program will run fine (JavaFX is a exception).

    Dart is a language meant for ui development, nothing else. The team doesn't seem interested in splitting up the language from the Flutter framework. There have been tons of work from the community to provide tools for standalone application / backend development (see Shoelace and Serverpod).

    The pros is a beautiful, expressive language with awesome DX. Good range of packages available and easy to meta-program with, it's not on the Ruby level but with "extensions" you can do lots of fun stuff. Dart deserves more love than what it currently gets.

    • nunobrito 5 months ago
      That is a very fair and realistic review. Thank you for sharing your thoughts.

      I'm also on the same situation as Java/C++ developer considering Dart only because of Flutter that permits iPhone/Android development combined.

      • rlawson 5 months ago
        Same, I had zero interest in full native (takes too long) or things like React native (I hate javascript) and Dart/Flutter seems a decent path forward.
      • rlawson 5 months ago
        Thanks! I really do enjoy writing Dart. Hopefully one day it gets cross compile support. Go is nice in that regard but the syntax compared to Dart is not as expressive to me.
      • 5 months ago