updateTheme method
Update the theme and intelligently invalidate cache if needed
Implementation
void updateTheme(NodeFlowTheme newTheme) {
final oldTheme = _theme;
_theme = newTheme;
// Invalidate cache only if path-affecting properties changed
final pathChanged =
oldTheme.connectionTheme.style != newTheme.connectionTheme.style ||
oldTheme.connectionTheme.bezierCurvature !=
newTheme.connectionTheme.bezierCurvature ||
oldTheme.connectionTheme.cornerRadius !=
newTheme.connectionTheme.cornerRadius ||
oldTheme.connectionTheme.startPoint !=
newTheme.connectionTheme.startPoint ||
oldTheme.connectionTheme.endPoint !=
newTheme.connectionTheme.endPoint ||
oldTheme.portTheme.size != newTheme.portTheme.size;
if (pathChanged) {
invalidateAll();
}
}