🔥 Kotlin vs Dart Equality — 30 sec breakdown!
👨💻 Kotlin:
== → checks VALUE
=== → checks MEMORY (same object)
val a = "Hi"
val b = "Hi"
println(a == b) // true
println(a === b) // 🤔 maybe true (string pool)
🚀 Dart:
Only == exists → VALUE check
For memory → use identical()
String a = "Hi";
String b = "Hi";
print(a == b); // true
print(identical(a, b)); // true/false
💡 Quick Trick:
Kotlin → == vs ===
Dart → == + identical()
⚡ Save this before your next interview!
Top comments (0)