Sitemap
Dart

Dart is an approachable, portable, and productive language for high-quality apps on any platform. Learn more at .

Dart 3.1 & a retrospective on functional style programming in Dart 3

12 min readAug 16, 2023

--

Diff of a Dart 3 refactor using functional style features within Dart’s internal code base

How do you model data?

Simplified side-by-side comparison of the object-oriented class hierarchy model and the functional algebraic data type model

Object-oriented approach

Functional approach (algebraic data types)

Modeling object oriented algebraic data types

Grouping behaviors across types

Annotated depiction of the syntax for a deeply nested object and variable patterns

Exhaustiveness checking

The type 'FileSystemEvent' is not exhaustively matched by the switch cases since it doesn't match 'FileSystemSyncEvent'

Bonus functional features

Summary

Resources

Dart
Dart

Published in Dart

Dart is an approachable, portable, and productive language for high-quality apps on any platform. Learn more at .

Marya Belanger
Marya Belanger

Responses (11)