Quick tip: Always use const widgets when possible
A reminder I keep giving myself: mark widgets as const whenever possible.
// Bad: Creates new instance on every rebuildchild: Icon(Icons.home)
// Good: Reuses the same instancechild: const Icon(Icons.home)Why it matters:
constwidgets are created at compile time, not runtime- They’re cached and reused, reducing memory allocations
- Flutter can skip rebuilding them entirely during reconciliation
Enable the prefer_const_constructors lint in analysis_options.yaml:
linter: rules: - prefer_const_constructorsYour IDE will then highlight every opportunity to add const. Small change, real performance gains.