Wednesday, 3 May 2017

Moving To AngularDart 3

Angular Dart 3 final was released and NP8080 (simple web based text editor) has been built with the latest version. It has been a fun little project and I have found myself using it daily as a scratchpad.

Not a massive amount to report - Angular very stable since the Betas. Certainly feeling a bit more Dart-y. The most disruptive change was the deprecation of EventEmitter but as this was a thin wrapper around a standard Dart Stream it wasn't much of a loss though I had 20 occurrences to update!

The code is straightforward as:

  final StreamController onShowDialogChange = new StreamController();
  ...
  @Output()
  Stream get showDialogChange => onShowDialogChange.stream;
  ...
  void closeTheDialog() {
    showDialog = false;
    onShowDialogChange.add(showDialog);
  }

Of course, another option is to copy the EventEmitter class into your own project. Interesting to see AngularDart using core Dart classes, perhaps the start of a larger divergence of the two codebases.

Looking back to the first build of NP8080, the output JS was 300k(ish). The current build is around 200k JS which is great improvement considering the increase of application code over that time. When you consider a basic Dart web app is around 110k, it is even more impressive to have Angular framework squeezed into <90k.

Please raise an issue if you have a feature request. PRs welcome too!