Dart is an open-source, scalable, object-oriented programming language, with robust libraries and runtimes, for building web, server, and mobile apps. It is developed by Google, and it became an ECMA standard.
Pro Great async language support
Dart is a single threaded programming language. So if any piece of code blocks the execution of the program, the program practically freezes. To avoid this Dart makes use of asynchronous operations which let your program run without getting blocked. This is done through Future objects.
A Future is an object which represent a means for getting a value at a certain point in the future. A function may invoke a Future and when that happens, two outcomes can be achieved:
- The function is unable to return a value, so it queues up work to be done and returns an uncompleted Future object.
- Or later when a value is available to be returned, the Future object completes with that value.
Pro Great standard library
Dart includes a truly comprehensive core library, making it unnecessary to include disparate, external resources for basic functionalities Other than reducing the need to pull in various 3rd-party utilities this also ensures that all Dart code looks and feels the same.
Out of the box, the developer gets core libraries to help with: async, collections, strings, regexps, conversions, formats, file I/O, math, typed data, and more.
Pro A lot of tools are available to help in developing with Dart
Dart has a lot of tools available which help with developing Dart applications. Some examples of those tools include:
- pub - package and dependency management and build tool
- analyzer - static syntax analysis with linter, quick fixes, autocompletion support for easy IDE integration
- test - powerful and flexible testing framework and test runner
- dev_compiler - generate reusable JS instead of tree-shaken minified JS output (work in progress)
- dartfmt_ - source code formatter
- server-side VM
- observatory - a powerful tool for profiling and debugging running Dart code (for Dartium and Dart server code)
In Dart many browser differences (subtle differences and also missing features) are abstracted away or polyfilled. When Dart is transpiled to JS the output works on all supported browsers. There is usually no need to load polyfills or to consider browser differences during development. No need for libraries like jQuery to make the same code work the same on all browsers.
Pro Support of semi-coroutines (generators)
Generators, also known as semicoroutines, are also a generalization of subroutines.
Generators are primarily used to simplify the control of iteration behavior of a loop, the
yield statement in a generator passes a value back to a parent routine.
A generator is very similar to a function that returns an array, in that a generator has a certain number of values. But instead of building and returning an array that contains all the wanted values, a generator returns them one at a time, this saves memory and allows the caller function to start processing the first few values immediately.
Con Dart SDK does not provide standard (out of the box) way to access SQL-based databases on server side
This missing (but very popular) feature requires to use 3rd-party packages developed by the personal enthusiasts or very small groups of enthusiasts, which is not very convenient because they are all very fragmented in terms of content, the essence and capabilities.
Flagged Pros + Cons
Pro A very clear well thought standard library
Out of the box, the developer gets core libraries to help with async, collections, strings, regexps, conversions, formats, file I/O, math, typed data, and more. This reduces the need to pull in various 3rd-party utilities and ensures that all Dart code looks and feels the same.
Pro Dart is used to build web, server and mobile applications, and for Internet of Things (IoT) devices
Pro The fastest and performance driven
With using own VM, Dart is the fastest language for the web. Dart is built with performance in mind. It is a nasty decision by microsoft and apple by not embedding Dart VM in their own browsers. Though, compile to js version is also faster than any other Compile to JS languages
Con No strong community involvement in the work on the specification, grammar, language
Dart developers rarely take suggestions on improving the language in consideration. Although the developers have been suggesting changes since 2011 in the mailing list, these suggestions are rarely included in the Dart Enhancement Proposals (DEP) which is mostly written by Google engineers.
Some people in the Dart community feel that this is inadequate since a lot of programmers who are part of that community are highly respected engineers and professionals who may have valuable input to give.
Pro Supports privacy without verbosity by avoiding the keywords public, protected, and private
Every Dart application is a library, even though it doesn't use a library directive.
Libraries not only provide APIs, but are also a unit of privacy. Although in this area Dart is a little bit different from other languages as since is does not have the
public keywords. Instead Dart uses underscores (_) to denote private functions or variables.
foo() is a publicly available function and can be accessed when the library is imported somewhere else. If you want to keep this method hidden, you add an underscore:
_foo() and it behaves like protected, now it can't be accessed when the library is imported somewhere else.
This helps with having less verbose and easier to understand code