DEV Community

Angular Apps in TypeScript or Dart?

Jake Varness on December 05, 2017

Edit: if you are new to TypeScript syntax, you might find this article by @abelagoi helpful. If you're new to Dart, I'll try to write something abo...
Collapse
 
fly0c8 profile image
fly0c8

I've gone through both tutorials and I find the Dart version much more intuitive, especially when it comes to async/await vs. Rx. Dart is the better language and the tooling is better too. And then there is Flutter, which seems like the best thing since sliced bread when it comes to mobile development.

That said, the community seems to be nonexistent. That's why I'm forced to use Typescript at my company instead.

Collapse
 
stormingorman profile image
Brian Gorman

Dart is a much superior language to Typescript from an OOP perspective but also, and maybe more importantly, because of their collection and stream api. Also, dart has a lot of the niceties found in modern languages like optionals and class-as-interface ..

The interoperability between Typescript and Javascript is one of the biggest weaknesses of Typescript in my opinion. A lot of the main problems of javascript can bleed through and coexist with typescript. Not unlike how C-code is also valid inside of C++ code .. and C++ suffered from the same low level caveats found in C.. It was a mistake to try to put OOP on-top of C and it is still a mistake to put OOP on-top of JS... But they did it for the same reasons.. you can use all your old C libraries ! Code is much more stable and cleaner if these low-level problems are abstracted away. With a strongly typed language with optionals, bugs and crashes can often be discovered at compile time. And as you point out, the async support is first class.

Dart's functional support is awesome... its Collection API and optionals makes it where you rarely need to ever explicitly write an if statement or a for loop.. It is strongly typed with many of the bells and whistles of modern languages like Swift and Kotlin. I've developed client and server side code with both typescript and dart and in my view there is no question which is the better language.

Collapse
 
creativ_bracket profile image
Jermaine

Thanks Jake.

I was googling the angular_cli tool and that got me here. I had read this post a while back but forgot all about it. I wished I remembered this before making the AngularDart tutorial series on my YT channel.

Collapse
 
jvarness profile image
Jake Varness

If you want to use this article to inspire another video feel free 😊 although this is pretty old and was using Angular Dart 4.X. They've since added dependency injection and all that.

Collapse
 
stargator profile image
Stargator

By the way, Angular 5 will have the Module system and it will be optional. Already implemented in the development version of Angular 5

Collapse
 
jvarness profile image
Jake Varness

Angular Dart right? Yea at the time that I wrote this they hadn't implemented it yet!

Collapse
 
stargator profile image
Stargator

Angular Dart version 5, yep. Left that part out.

Collapse
 
zaatas profile image
Matthew Rockwell

Jake, many thanks for this article. Cleared a few things up for me. I've built 2 flutter prototype apps; enough to prove to myself Darts/Flutter's worthiness. Yes, it's a keeper. That said, I don't know squat of Angular. I've been using react/vue for browser work and java/kotlin (I really like kotlin) for the server side. So, it's time to learn Angular for js and dart... Thanks again.

Collapse
 
jvarness profile image
Jake Varness

Glad you enjoyed this post Matt! Kotlin is definitely on my list of languages to learn!

Collapse
 
bobrov1989 profile image
Vitalii Bobrov • Edited

Great post! Just few issues with code examples:

  • don't use Null as return type, as it's low-level type you don't want to use in 99% of cases -so instead Future<Null> use Future<void>
  • It is a good practive to keep ngOnInit sync = you can extract the async setup into separate method and call it wrapped in unawaited() for example
Collapse
 
alinawxn profile image
Xiaonan Wang

WOW I was just googling about angular dart and your name popped up! How's it going!

Collapse
 
jvarness profile image
Jake Varness

Hey Alina! Doing great! 😁 How's it going with you?

Collapse
 
stargator profile image
Stargator

This is perfect Jake, it crossed my mind to do something similar when I went through both tutorials. Great job!