Kotlin for Dart Developers
Move from Dart to Kotlin through null safety, collection ownership, functions, properties and object contracts. Build a connected multi-file order processor and port a stock ledger.
Dart and Kotlin side by side
The same program in Dart and in Kotlin, from the lessons of this course.
Strings and Templates
Dart and Kotlin both interpolate dollar-prefixed names and braced expressions inside strings. Dart permits single-quoted strings, whereas Kotlin reserves single quotes for Char. Dart main and Kotlin main are entry functions, but Kotlin supporting files…
Dart1void main() {2var ready=3; print("Ready: $ready");3}Kotlin1fun main(){2val ready=33println("Ready: $ready")4}Equality and Identity
Dart strings compare contents with equality, while identical tests identity. Kotlin uses == for structural equality and === for reference identity. User-defined Dart classes may override equality and hashCode, just as Kotlin classes need an appropriate…
Dart1void main() {2var a=String.fromCharCodes([116,101,97]); print(a=="tea");3}Kotlin1fun main(){2val a=String(charArrayOf('t','e','a'))3val b=String(charArrayOf('t','e','a'))4println(a==b)5}Arrays and IntArray
Dart List can be growable or fixed-length depending on its constructor. Kotlin Array and primitive arrays are fixed-size; MutableList supplies a different API for growth. Both allow indexed element access, but a fixed-length list can still permit element…
Dart1void main() {2var values=List<int>.of([4,8,12],growable:false); print(values.last);3}Kotlin1fun main(){2val a=intArrayOf(4,8,12)3println(a.last())4}While, Break, and Continue
Dart and Kotlin provide break and continue, with related labeled-loop facilities using different syntax. A continue path must still let a while loop progress. The example separates skipping an empty word from ending on STOP. Kotlin string equality preserves…
Dart1void main() {2var kept=<String>[]; for(var word in ["tea","","STOP","coffee"]) { if(word=="STOP") break; if(word.isEmpty) continue; kept.add(word); } print(kept.join(","));3}Kotlin1fun main(){2val kept=mutableListOf<String>()3for(word in listOf("tea","","STOP","coffee")){if(word=="STOP")break;if(word.isEmpty())continue;kept.add(word)}4println(kept.joinToString(","))5}Top-level Functions
Dart supports top-level functions and arrow bodies, as does Kotlin with different punctuation. Dart optional types and dynamic can defer checks that Kotlin static types retain. Return types and nullable results should be chosen explicitly at API boundaries.…
Dart1bool isLong(String text) => text.length>4;2void main() {3print(isLong("coffee"));4}Kotlin1fun isLong(text:String):Boolean = text.length>42fun main(){3println(isLong("coffee"))4}Input and String Formatting
Dart trim and toUpperCase have direct-looking Kotlin counterparts, but text indexing and Unicode behavior still require care. Both Dart String and JVM Kotlin String represent UTF-16 sequences. The examples use ASCII so casing and code-unit counts are stable.…
Dart1void main() {2print(" tea ".trim().toUpperCase());3}Kotlin1fun main(){2println(" tea ".trim().uppercase(java.util.Locale.ROOT))3}
Syllabus
10 chapters48 lessons1 project48 challenges99 quiz questionsStarting Kotlin
6 lessonsValues and Decisions
5 lessonsCollections and Ownership
5 lessonsIteration and Transformations
5 lessonsFunctions and Callbacks
5 lessonsInput, Errors, and Files
5 lessonsClasses and State
6 lessonsComposition and Value Types
5 lessonsProject: Order Processing
4 lessonsFinal Challenges
2 lessonsFrequently asked questions
Who is Kotlin for Dart Developers for?
For people who already write Dart and want to learn Kotlin. Each lesson starts from Dart you know and shows how Kotlin does the same thing, so you skip the beginner basics.
Do I need to know Kotlin already?
No. The course starts with your first Kotlin program. You need Dart basics: variables, conditions, loops, functions and collections.
How many lessons does Kotlin for Dart Developers have?
Kotlin for Dart Developers contains 48 interactive lessons you can complete at your own pace.
What does Kotlin for Dart Developers cover?
The course is organized into chapters covering: Starting Kotlin, Values and Decisions, Collections and Ownership, Iteration and Transformations, and more.
Is Kotlin for Dart Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.