Evaluate Dart as an alternative to Node.js for server-side development. This repository should serve as rough outline about the differences and similarities to Node.js.
- Built in linter.
- Standard lib is shipped as SDK and written in Dart itself. We can debug the whole stack by pressing "F12". In Node.js the standard lib is embedded with the binary.
- Provide
puba package manager likeNPM. - Full vscode support.
- Opinionated formatting like gofmt or prettier called "dartfmt".
- Dartdocs Automated documentation generation for Pub packages.
- Code completion, GoTo, Find References, Renaming ...
- Great tools for testing, benchmarking and mocking.
- Built in profiling tool shipped with the SDK observatory.
- Multithreading support by isolates:
Isolates communicate by passing messages over channels, which is similar to actors in Erlang or web workers in JavaScript.
- Smother async error handling and debugging by the concept of zones.
- Simple and robust streaming api
- Async module loading
- Reduce startup times by using snapshots
Known as
app-jitsnapshots - Dart transpiles to JavaScript.
- Build native Android and IO's apps in record time with flutter
- Async-iterators
- On-catch
- Sync-iterators
- Null-Aware Operators
- Ranges
- typedefs
- cascade operator (..)
- ...
- Strongly typed
- Type inference
- Generics
- OOP language with classes and mixin-based inheritance
- Dart use AOT (Ahead Of Time) as well as JIT (Just In Time) compiling techniques. Read the great article Why Flutter Uses Dart
- It's an ECMA-408 standard
- ...
- Language syntax and concepts are very similiar (Single-threaded, Event-loop, async/await, error-handling try/catch...)
- Use Futures as companion compared to Promises
- Has it's own registry like NPM called https://pub.dartlang.org/
- Dart compiles to ARM and x86 code
- Dart can be compiled to Javascript with dart2js
- Backed by Google like V8.
- Battled tested by Google and many other companies
- Faster as V8
- Travis support
- Google provides docker images here
If you don't use Node.Js for isomorphic applications and if you don't rely heavily on other javascript libraries use Dart it will boost your productivity to Over 5000. You can still apply many concepts from Node.Js like Classes (ES6), Mixed Inheritance, Event Loop characteristics, Promises (Futures), Async/Await, try/catch, Streams, lexical scoping, closures... without to negotiate about performance and compatibility.
- Install DartVM
- Run
pub get
# Run tests
pub run test ./test/test.dart
# Run benchmarks
dart ./benchmark/benchmark.dart
# Install a package
pub get $name
# Install a package as executable
pub global activate stagehand
# Run profiler
dart --observe .\main.dart
# Compile to JS
dart2js .\main.dart
# Create app snapshot
dart --snapshot=main.dart.snapshot main.dart