AngularDart 3.0 goes all in, flaunts smaller generated code

AngularDart 2.0 was unveiled in October 2016 so it’s time for the next release. What does AngularDart 3.0 have to offer? Better performance, smaller generated code and the promise to make you more productive.
AngularDart 3.0’s progress might not be immediately visible but that doesn’t mean it’s not there. According to the blog post announcing the new release, AngularDart 3.0 “is a smooth upgrade due to minimal public API adjustments. Most of the progress is under the hood—in code quality, stability, generated code size, performance, and developer experience.”
AngularDart 3.0: The change is in the details
As far as code quality is concerned, there are 2731 instances of making the framework code more type safe (using sound Dart) and the framework code size is down by 12 percent. Furthermore, there are plenty of additional style updates to the codebase:
- Changed to use idiomatic
<T>
for generic methods. - Removed
NgZoneImpl
, all the code exists inNgZone
now.
If we talk about stability, you should know that there are a lot of CSS encapsulation fixes due to update with csslib package, as well as fixed bugs with IE11.
Performance
Time-to-interactive (currently 3812 ms on a simulated 3G connection, measured via Lighthouse) is now 30 percent faster for the Mail sample app while render times of very deep view hierarchies (65ms versus 128ms in October) appear to be 2x faster, according to their large app benchmark.
For AngularDart Components, massive improvements can be noticed in performance. For example, the <material-button>
component gets initialized 1.5x faster (0.5ms versus 0.7ms in October).
Generated code size
The list of improvements continues with the generated code size.For a small app (GWT Mail sample app), there’s been a three percent reduction since October (when 2.0 was released) and a 24 percent reduction since August (when AngularDart went all Dart).
For large apps, there’s been a 13 percent reduction since October and a 29 percent reduction since August.
SEE ALSO: To the future & beyond: AngularDart 2.0
Other changes that promise to make developers’ lives easier
Simplified API
- Simpler
onPush
change detection usingComponentState
andsetState
. - Only one
load
method (instead ofloadAsRoot
,loadAsRootIntoNode
). - Got rid of
TitleService
, use idomaticdocument.title
instead. - Removed
viewBindings
(useviewProviders
). ngSwitchCase
replaces the soft deprecatedngSwitchWhen
.XHR
is deprecated.EventEmitter
is deprecated: use the idiomaticStream
andStreamController
instead.- Removed
IterableDifferFactory
. - A name parameter is now required for all
@Pipe(...)
definitions:@Pipe(name: 'uppercase')
is replaced by@Pipe('uppercase')
. null
is no longer propagated as an initial change value. Fields must start with a non-null value.- Removed
NgPlural
; use the much more dart-ypackage:intl
instead.
Catching bugs earlier
- selector is now a
@required
property. ngIf
throws if the bound value changes during change detection.- In generated
.template.dart
change detected primitives are typed.
Testing
package:angular_test
with improvedNgTestBed
.
Dev mode tweaks
- New
isDebugMode
function. - Warning when Dartium is run without checked mode.
- By default, the
ExceptionHandler
is aBrowserExceptionHandler
which prints to console. You can override it if you don’t want this behavior (for example, when releasing to production).
Read more about AngularDart 3.0 in the changelog.
asap