More in Flutter & Dart — page 16
Dart Collections: Choosing List, Set, or Map
Dart collections organize data: use a List for ordered items, a Set for unique items, and a Map for key-value pairs. This choice is fundamental for storing UI widgets or parsing JSON. The common footgun is using a List for lookups, which is slow; use.
Dart Function Syntax: Block Body vs. Arrow Notation
Dart functions use a block body `{}` for multiple statements or arrow syntax `=>` for a single expression. Use `=>` for simple one-liners like `bool isEven(int n) => n % 2 == 0;`. The footgun is using `=>` for multi-step logic; it only works for.
Dart's Control Flow: Telling Your Code What to Do Next
Control flow statements are the road signs for your code, directing execution beyond a simple top-to-bottom path. Use `if`/`else` for decisions, `for`/`while` for loops, and `try`/`catch` to handle errors. The footgun is forgetting `break` in a `switch` case.
Dart's Core Data Types: Everything is an Object
In Dart, everything is an object, from numbers to functions. This means even a simple `int` or `String` has methods and properties, unlike primitive types in other languages. The main footgun is forgetting that `null` itself is a type, `Null`.
Dart Variables: var, final, and const
In Dart, `var` creates a mutable variable, while `final` and `const` are for single-assignment. Use `var` for changing state, `final` for runtime values set once, and `const` for compile-time constants. The footgun is confusing `final` with `const`.
Riverpod 3 brings code-gen to every provider
Riverpod 3 standardises on the @riverpod annotation. The legacy StateProvider / ChangeNotifierProvider APIs are deprecated, and the runtime gets a 30% smaller binary footprint thanks to removing the manual scoping machinery.
Flutter 3.27 ships impeller on Android by default
The new release flips the Impeller renderer on for all Android devices, dropping Skia for Vulkan/OpenGL. Smoother scrolling, faster first frame, and far fewer jank reports — at the cost of a slightly larger APK.