Skip to content
0:00 / 0:00

#flutter#dart#widget

Widgets vs helper methods | Decoding Flutter

Flutter

634K subscribers • 138 videos on Hallway

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • A classic. People kept recommending it from 2021 to 2025.
  • Presented by Craig Labenz
  • Made by the vendor. The company whose product it covers made or sponsored it.

Intermediate. Assumes working knowledge.

192K views4 years ago2 recommendations

Mobile developmentSoftware designFlutter and React NativeSoftware architecture

Craig Labenz compares breaking up large build methods using helper methods versus creating separate widget classes in Flutter.

Flutter developers are well-acquainted with widget build methods that grow, and grow… and grow. In this video, Craig Labenz compares two different ways to break up those unwieldy build methods; and how the best option may be different than what you originally suspected. See the differences in action in these DartPads: Managing rebuilds with nested const widgets → goo.gle/3yallg1 Managing rebuilds with nested non-const widgets → goo.gle/3IyafpM Preventing errors with separate widgets → goo.gle/3dDrR5o Helper methods can create a requirement for Keys → goo.gle/31HlnQB Get started with Flutter → goo.gle/Flutter Learn more about the Dart Language → goo.gle/2YF9OCi Watch more Decoding Flutter episodes → goo.gle/DecodingFlutter Don’t miss an episode, subscribe to Flutter → goo.gle/FlutterYT #DecodingFlutter #Flutter #Developer product: Flutter - Development - User interface;

Why it's here

2 people recommend this

What people say. Recommended as a clear explanation of why classes are preferred over helper functions for Flutter widgets.

u/Pixelredditin r/FlutterDev • Recommends

Widgets vs helper methods | Decoding Flutter

u/SuperRandomCoderin r/FlutterDev • Recommends

When is it preferable to use functions that return widgets (helper methods) instead of classes? Flutter's built-in widgets use this approach quite often—but why? Hi, I’ve noticed that many of Flutter’s built-in widgets use helper methods to return widgets. Here are a few examples (there are many more): * **Slider (decorator):** https://github.com/flutter/flutter/blob/main/packages/flutter/lib/src/material/slider.dart#L801 * **InputDecorator:** https://github.com/flutter/flutter/blob/70a3c3cc935e49b44db818348dd2d57f055ab762/packages/flutter/lib/src/material/input\_decorator.dart#L401 * **Stepper:** https://github.com/flutter/flutter/blob/70a3c3cc935e49b44db818348dd2d57f055ab762/pac…