Dart 3.1, the latest release of the Dart language, introduces functional style features that allow for more flexible data modeling. Dart, originally an object-oriented language, now incorporates pattern matching, switch functionality, and sealed types, which enable the implementation of algebraic data types. With algebraic data types, developers can write code in a functional style while still leveraging Dart’s object-oriented core. This article explores the benefits of both object-oriented and functional approaches to data modeling and demonstrates how to refactor object-oriented designs using Dart 3’s new features. The combination of functional and object-oriented paradigms allows developers to choose the best approach for their projects.
https://medium.com/dartlang/dart-3-1-a-retrospective-on-functional-style-programming-in-dart-3-a1f4b3a7cdda