Dart meets Kotlin? kt.dart ports the Kotlin Standard Library
We all love Dart. But, don’t we wish we could combine it with Kotlin? For everything that Dart may be missing for high-level programming, there’s kt.dart. This project ports the Kotlin Standard Library for Dart/Flutter projects. Why choose when you can have it all in one neat package?
As Kotlin’s usage continues to grow and improve, one thing becomes clear: Programmers love Kotlin. On the flip side, in the world of mobile app programming, Flutter is metamorphosing into the framework of choice. More and more programmers are picking up Dart as their general-purpose programming language for building apps. However, have you been longing for Kotlin when programming in Dartlang? Say no more! With kt.dart, you can have the best of all worlds.
While there are some similarities between the languages, the differences are numerous and huge. If you’ve felt that Dart is missing something in comparison to Kotlin, this might be the missing piece of the puzzle that you have been searching the skies for.
Just the basics from the GitHub repo: kt.dart is “a port of Kotlin’s Kotlin Standard library for Dart/Flutter projects. It’s a useful addition to
dart:core and includes collections (
KtSet) as well as other packages which can improve every Dart/Flutter app.”
For instance, Dart doesn’t have arrays, its arrays are Lists. Comparatively, Kotlin provides a rich standard library with higher-order functions and naming functions that follow a more standardized method. When it comes to business logic, Kotlin is a good choice.
From creator Pascal Welsch’s explanation of what high-level collections that Dart is missing:
“My job is to write business logic and SDK with stable APIs. This is much more challenging in Dart compared to Kotlin. Especially Dart’s collections aren’t perfect for the job. That’s why I ported Kotlins high-level collections to Dart, allow me to write better APIs.”
This project offers:
- Immutable collections by default
- Deep equals
- Common methods
Make sure to also dive deeper in Pascal Welsch’s Medium post about kt.dart. It is excellent reading that explains some of the finer points about what makes Kotlin’s library and immutable entities so desirable.
Before you get started
View the kt_collection library to see all 150+ methods that it comes packaged with.
As always, make sure to report any issues you encounter so that its creator can fine-tune it into the best that it can be.
Looking for more?
As of right now, kt.dart plans to add
While we wait for more modules from kt.dart, here are some more relevant projects that we recommend to help you hit the bullseye. Happy programming!
- Kiwi: Just as delicious as it sounds. Dependency injector library that simple, fast, and refreshing!
- Stagehand: Dart project generator for web apps, console apps, servers, and more.
- Hummingbird: Flutter’s web platform prototype. Keep your eyes peeled for future news and see it take flight.
Recently, we asked our readers about what programming language will be relevant to them in 2019. The number one answer was none other than Dart. Clearly, this language hits its target and showed big growth during 2018. In the growing ecosystem, make sure to add this project to the list!
Let’s see what unfolds in these next 11 months. Will 2019 be the year of Dart?