Thanks for your comment. I would say that rules are straightforward, but in the same time not mandatory. Flutter will show high performance even if you would write worst ever code. But for convenience I have this actions:
UI Rendering Performance:
Flutter uses its own rendering engine to draw widgets. To optimize, be mindful of the widget tree's depth and complexity. Avoid unnecessary nesting of widgets and prefer using const where possible.
State Management:
Efficient state management is crucial in Flutter. Tools like Provider, Riverpod, or Bloc help manage state more efficiently, reducing unnecessary widget rebuilds.
Image Optimization:
Large images can significantly impact performance. Use the cacheHeight and cacheWidth properties to downscale images. Consider using image formats like WebP for better compression.
Lazy Loading:
For lists with many items, use ListView.builder to build items on-demand as they're scrolled into view.
Avoiding Memory Leaks:
Be mindful of memory leaks:
Dispose of controllers, streams, and other objects when they're no longer needed.
Asynchronous Programming:
Use async/await judiciously. Avoid blocking the main thread and causing frame drops.
Using DevTools:
Regularly use Flutter DevTools for performance profiling. The DevTools provide insights into memory usage, widget rebuilds, and other performance metrics.
And finally
Keep your Flutter version up-to-date. The Flutter team continually works on optimization and performance improvements.
Hope it helps. Happy coding! :)