Overview
The render_metrics package provides a way to retrieve precise layout metrics for widgets in Flutter applications. By leveraging RenderObject, it enables developers to obtain accurate size and screen position data for widgets, as well as measure differences between widget states. This is particularly useful for debugging layout issues, implementing custom animations, or creating overlay elements that align with specific UI components. The library supports all major platforms including Android, iOS, Web, macOS, Windows, and Linux.
Use cases
- Debugging widget positioning
- Creating dynamic overlays
- Measuring layout changes
- Implementing custom animations
- Analyzing UI performance
Key features
- Access to widget size and screen position
- Comparison of widget metrics over time
- Cross-platform compatibility
- Integration with RenderObject
- Lightweight and focused API
Suitable for
- UI debugging tools
- Custom layout utilities
- Animation frameworks
- Developer tooling
- Performance analysis
Considerations
- Requires access to RenderObject context
- May impact performance if used excessively
- Not suitable for runtime metrics in high-frequency scenarios
- Limited to visible widgets during rendering