Dart 2.12 release — Null Safety

Take a look at Dart null safety and learn how to migrate your Flutter project to it.

Evan Fang
5 min readMar 10, 2021

March 3, 2021: 2.12 release

This section lists notable changes made from October 2, 2020, through March 3, 2021. For details about the 2.12 release, see Announcing Dart 2.12.

Just few days ago, Dart 2.12 finally released. One of it’s cool features is null safety, which is a life saver for all Flutter developers.

Null safety is a very powerful feature that can prevent your app from NullPointException. You can clearly declare whether a variable can be null or not. Then handle the null case if it is nullable; otherwise, just use it directly.

Table of contents

  1. Overview: Sound null safety
  2. Migrating your Flutter project to null safety
  3. Using the migration tool

Overview: Sound null safety

The official documentation contains a very clear explanation about null safety.

If you have learned Swift or Kotlin before, you must be familiar with null safety. Dart null safety is kinda like what Swift or Kotlin does, with only small differences in syntax. So I’m not going to describe lots…

--

--