Dart meets Kotlin? kt.dart ports the Kotlin Standard Library

Share
  • February 1, 2019

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.

Kotlin-like Dart?

SEE ALSO: All about Kotlin: 8 steps to app creation

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 (KtListKtMapKtSet) as well as other packages which can improve every Dart/Flutter app.”

The motivation behind its creation lies in some of the shortcomings of Dart’s core package. The dart:core package, for instance, when compared to kotlin-stdlib is too low level.

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

Authored by Pascal Welsch under the Apache 2.0 license, the readme can be viewed here.

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

The package is available here; give it a whirl!

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?

SEE ALSO: Flutter developers survey: Documentation is key to Flutter’s success

As of right now, kt.dart plans to add asynctuplescomparisonrangesequence, and text modules.

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?

The post Dart meets Kotlin? kt.dart ports the Kotlin Standard Library appeared first on JAXenter.

Source : JAXenter