useRepaintBoundary property
Whether to wrap the rendered widget in a RepaintBoundary.
When enabled (default), the widget is wrapped in a RepaintBoundary, which isolates it from parent widget repaints. This improves performance in list views and scrollable containers by preventing unnecessary redraws.
Performance Impact:
- Reduces overdraw in scrolling lists
- Isolates expensive rendering operations
- ~20-30% FPS improvement in list scenarios
Set to false if:
- The widget is very small and simple
- You're experiencing layout issues
- The widget is already inside a RepaintBoundary
Example:
// Enable for list items (default)
ListView.builder(
itemBuilder: (context, index) {
return SmoothMarkdown(
data: messages[index],
useRepaintBoundary: true, // default
);
},
)
// Disable for simple standalone widgets
SmoothMarkdown(
data: '**Bold text**',
useRepaintBoundary: false,
)
See also: enableCache for parsing performance optimization.
Implementation
final bool useRepaintBoundary;