Some teams in Ghana and abroad build native Android apps, and several adverts we read, from an agritech company and remote employers, asked for Kotlin, sometimes alongside Flutter. Cross platform roles often list Kotlin or Swift as a bonus, because developers who understand the native side can fix platform specific problems. Learning Kotlin after Flutter is much easier than starting from zero, because you already understand the big ideas.
Kotlin in a few lines
Kotlin is Google's preferred language for Android. If you know Dart, much of it will feel familiar:
data class Product(val name: String, val price: Double, val qty: Int)
fun needRestock(items: List<Product>): List<String> =
items.filter { it.qty < 5 }.map { it.name }
fun main() {
val stock = listOf(Product("Rice", 120.0, 8), Product("Oil", 45.0, 2))
println(needRestock(stock))
}Notice the similarities and differences:
valis like Dart'sfinal;varcan change.- Types come after names:
name: String. - A data class gives you a class with equality and copying built in.
- Kotlin also has null safety: means the value may be null, and provides a fallback, like Dart's .