79104959

Date: 2024-10-19 12:49:11
Score: 0.5
Natty:
Report link

I’d recommend keeping functions outside the build method. It keeps your code cleaner and avoids recreating the function every time the widget rebuilds, which is better for performance. If it’s a simple one-liner, defining it inside is fine, but for anything more, it's best to separate the logic.

using outside:

using inside:

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Ildeberto Vasconcelos