Mobile apps

What is null safety?

Null safety is a programming language feature that makes the compiler track which values may be missing, so code cannot accidentally use an empty value. It removes one of the most common causes of mobile app crashes.

The problem it solves

Older code could read a customer's phone number that was never set and crash with a null pointer error, often only on a user's phone. With null safety, a field that may be empty is marked as such, and the compiler refuses code that uses it without a check.

In today's mobile languages

Dart, the language of Flutter, has had sound null safety since version 2. Kotlin builds it into its type system, using a question mark for nullable types. Swift uses optionals for the same purpose.

What it means in practice

  • Fewer crashes reach production, which lifts the crash-free users rate.
  • Data from servers must be modeled honestly: if the API can omit a field, the app type must allow it.
  • Old code and libraries from before the feature need migration, which is a good sign to check when taking over a legacy app.

Questions, answered

No, only the crashes caused by missing values. Logic errors, memory limits and bad data still crash apps.

It is a staged job; tools help, but mixed old and new code takes careful testing.

By the Stegnor team · Updated