null-safety Flutter Interview Questions
2 questions
Advertisement
BeginnerDart Questions
What is null safety in Dart?
Sound null safety means the compiler distinguishes nullable (`String?`) from non-nullable (`String`) types and guarantees, at compile time, that a non-nullable variable can never hold null.
BeginnerDart Questions
What does the late keyword do in Dart, and what's a common mistake with it?
late tells the compiler a non-nullable variable will definitely be assigned before use, even though it can't verify that at compile time — deferring the null-safety check to runtime, where accessing it before assignment throws a LateInitializationError.
Advertisement