Sealed Class in Dart - Flutter Tutorial .pptx

AhmadFatihin5 12 views 14 slides Sep 06, 2024
Slide 1
Slide 1 of 14
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14

About This Presentation

Sealed Class in Dart


Slide Content

Sealed Class in Dart b y Masfran

What is sealed class A sealed class is a special kind of abstract class that restricts its subclasses to a predefined set. This means that all possible subclasses of a sealed class must be defined within the same file as the sealed class itself, and no new subclasses can be added outside of that file.

How to write sealed class

What is the difference with abstract class

Dart 3 pattern matching Dart 3 introduce pattern matching and sealed class. We will focus on Switch statements and expressions.

Pattern matching + sealed class Sealed class leverage pattern matching

Freezed deprecated function (in the future)

Map/When map, mapOrNull, maybeMap when, whenOrNull, maybeWhen

?

Disadvantages Can’t use curly braces in pattern matching switch expression Solution: use switch statements

So what next? Affected to the Wolkk project codebase Refactor When? When freezed deprecated the method or sooner? Refactor strategy? Consistency across all project in Wolkk!

W hat's exciting in darts going forward! Flutter macros https://github.com/millsteed/macros https://github.com/dart-lang/language/blob/main/working/macros/feature-specification.md
Tags