Migrating to ngx_*


The original AngularDart packages (ngdart, ngforms, ngrouter, ngtest) stopped receiving updates and their last releases stayed as -dev pre-releases. The insinfo/angular fork republished the exact same code as stable versions under the ngx_* family.

From ngdart 8.0.0-dev to ngx_dart 8.0.0

The public API is identical — only the package names changed. Migrating an app is a mechanical find & replace:

1. Update pubspec.yaml:

# Before                          # After
dependencies:                     dependencies:
  ngdart: 8.0.0-dev.4               ngx_dart: ^8.0.0
  ngforms: ^5.0.0-dev.3             ngx_forms: ^5.0.0
  ngrouter: ^4.0.0-dev.3            ngx_router: ^4.0.0
dev_dependencies:                 dev_dependencies:
  ngtest: ^5.0.0-dev.3              ngx_test: ^5.0.0

2. Update the imports in your Dart code (project-wide find & replace):

package:ngdart/   -> package:ngx_dart/
package:ngforms/ngforms.dart   -> package:ngx_forms/ngx_forms.dart
package:ngrouter/ngrouter.dart -> package:ngx_router/ngx_router.dart
package:ngtest/angular_test.dart -> package:ngx_test/angular_test.dart

3. Rebuild:

dart run build_runner build --delete-conflicting-outputs

Preparing for 9.x: package:web

The next generation (ngx_dart 9.0.0-dev.*, developed on the master branch) replaces the deprecated dart:html / package:js stack with package:web and dart:js_interop — the same move the Dart team made for the whole ecosystem. It unlocks WebAssembly (dart2wasm) support and keeps the framework aligned with the browser APIs of the Web IDL.

Your templates and components do not change, but application code that touches the DOM directly will need the standard Dart migration. The checklist, condensed from the official migration guide:

  • Swap the import: import 'dart:html';import 'package:web/web.dart'; and run dart pub add web.
  • Renames: package:web uses the original IDL names (HtmlElementHTMLElement, appendChild is append, ...). Run dart fix --dry-run to apply most renames automatically.
  • Element vs HTMLElement: querySelector returns Element; downcast with as HTMLElement when you need .style and friends.
  • Lists: querySelectorAll/children no longer implement List; iterate with the item()/length pair or the package:web helpers.
  • Type tests: obj is InputElementobj.isA<HTMLInputElement>() (Dart 3.4+).
  • Callbacks: listeners passed to raw DOM APIs need .toJS (addEventListener('click', callback.toJS)). Stream-based onClick.listen(...) keeps working via the helpers.
  • Conditional imports: replace dart.library.html with dart.library.js_interop.
  • Nullability: some package:web APIs are stricter than dart:html — e.g. style.setProperty() takes a non-nullable String (use '' to remove a property, which is what null used to do).

Version map

ngx_dart (was ngdart)
8.0.0 (package) — next: 9.0.0-dev
ngx_forms (was ngforms)
5.0.0 (package)
ngx_router (was ngrouter)
4.0.0 (package)
ngx_test (was ngtest)
5.0.0 (package)
ngx_compiler (was ngcompiler)
3.0.1 (package)
ngx_ast (was ngast)
3.0.0 (package)