Pattern Matching to the rescue!
summary
Pattern matching in Dart becomes concrete: switch as expression returns values, wildcard _ supplies fallbacks, and class patterns extract fields from a Point (x,y) to match x == 0 or x in {3,5,9}. Enums require exhaustive cases or a wildcard. Lists support head/tail and fixed-length patterns; maps match keys and distinguish null value vs missing key (example: JWT present vs absent). The when checks external vars feature combines an extracted field with an outside condition.
AI-written summary · about
chapters (9)
- 0:00Pattern matching intro
- 2:42Switch limits and Dart syntax
- 5:18Switching on classes
- 8:09Handling enums exhaustively
- 9:13Extracting with when
- 11:45Pattern matching lists/maps
- 14:57Null checks and map extraction
- 17:33Efficient pattern matching tips
- 19:46Closing & Q&A
related talks
33mShould We Flutter?
39mSwift Cheatsheet for Android/Kotlin Developers
33mLet's shake the Flutter tree
25mTell Me Quando - Implementing Feature Flags
44mIdio~~ma~~tic Kotlin
40mLibraries I wish I knew about when I started
40mPlaying with Experimental Kotlin Features
06mFlutter: Falling in Love Again with Mobile and Web Dev
