What is a Dart typedef?

Last reviewed in January 2020 by Frank Treacy

A typedef essentially defines the signature of a function (callback).

Look at the example below. The crazy function complies with the “type definition” of Comparison, which is exactly what we can feed to a List’s sort function.

Open the console and hit “Run” several times!

The best from the Flutter-verse in 3 minutes or less? Join Snacks!

Delivered twice monthly. No link walls. No spam. EVER.