Dart Articles

Articles related to Dart

Dart: Algebraic Data Types

Dart: Algebraic Data Types

Algebraic Data Types (ADTs) are a powerful functional programming concept that allows developers to model complex data structures more elegantly than traditional object-oriented classes. They are composite types, meaning that they combine other types. Dart 3.0 introduced Dart sealed class pattern matching, which made ADTs possible in Dart 3. Dart Switch Expressions leverage pattern matching well. This article explains the concept of ADTs, how to use them in Dart, and why using them with pattern matching solves so many traditional code-design problems that OOP languages tend to struggle with. What are Algebraic Data Types? The official Dart documentation doesn’t explain ADTs, or Dart’s relationship to ADTs very well. It glosses over the concept and only introduces one aspect of ADTs in Dart. This article gives a broader perspective on ADTs outside of Dart and gives some examples in other languages....
Christian Findlay Christian Findlay Jul 05, 2024
Dart Switch Expressions

Dart Switch Expressions

Dart 3 adds a new feature called Switch Expressions. Dart is a multi-paradigm language that supports both object-oriented, imperative, functional-style and declarative programming. Programmers have...
Christian Findlay Christian Findlay May 11, 2023