feat: add unknown widget fallback mechanism to VirtualWidgetRegistry - #516
feat: add unknown widget fallback mechanism to VirtualWidgetRegistry#516RamSuthar-Digia wants to merge 1 commit into
Conversation
WalkthroughTwo framework files modified to implement a fallback mechanism for unknown widget types. A new Changes
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/src/framework/ui_factory.dart`:
- Around line 180-194: The unknownWidgetFallback closure is passing the builder
callback after named parameters to VirtualBuilderWidget which expects the
builder as the first positional argument; update the call in the
unknownWidgetFallback (where VirtualBuilderWidget is constructed) to supply the
builder callback (e.g. (_) => DefaultErrorWidget(...)) as the first positional
argument and then pass commonProps, parentProps, parent, refName,
extendHierarchy as named parameters so the argument order matches
VirtualBuilderWidget's constructor.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7965393b-77cd-4c5b-b8d2-500d0ae078ae
📒 Files selected for processing (2)
lib/src/framework/ui_factory.dartlib/src/framework/virtual_widget_registry.dart
| unknownWidgetFallback: (type, data, parent) { | ||
| if (DigiaUIManager().host is DashboardHost || | ||
| DigiaUIManager().host is PreviewHost || | ||
| kDebugMode) { | ||
| return VirtualBuilderWidget( | ||
| commonProps: data.commonProps, | ||
| parentProps: data.parentProps, | ||
| parent: parent, | ||
| refName: data.refName, | ||
| extendHierarchy: false, | ||
| (_) => DefaultErrorWidget( | ||
| refName: data.refName, | ||
| errorMessage: 'Unknown widget type: $type', | ||
| ), | ||
| ); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== VirtualBuilderWidget constructor signature ==="
head -60 lib/src/framework/base/virtual_builder_widget.dart
echo ""
echo "=== Fallback call site in DUIFactory.initialize (lines 176-197) ==="
sed -n '176,197p' lib/src/framework/ui_factory.dartRepository: Digia-Technology-Private-Limited/digia_ui
Length of output: 2696
Move the builder callback to the first positional argument of VirtualBuilderWidget.
The VirtualBuilderWidget constructor requires builder as the first positional parameter, but the fallback at lines 184–194 passes named arguments before the builder callback. This violates Dart's argument syntax and will not compile.
Suggested fix
if (DigiaUIManager().host is DashboardHost ||
DigiaUIManager().host is PreviewHost ||
kDebugMode) {
return VirtualBuilderWidget(
+ (_) => DefaultErrorWidget(
+ refName: data.refName,
+ errorMessage: 'Unknown widget type: $type',
+ ),
commonProps: data.commonProps,
parentProps: data.parentProps,
parent: parent,
refName: data.refName,
extendHierarchy: false,
);
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@lib/src/framework/ui_factory.dart` around lines 180 - 194, The
unknownWidgetFallback closure is passing the builder callback after named
parameters to VirtualBuilderWidget which expects the builder as the first
positional argument; update the call in the unknownWidgetFallback (where
VirtualBuilderWidget is constructed) to supply the builder callback (e.g. (_) =>
DefaultErrorWidget(...)) as the first positional argument and then pass
commonProps, parentProps, parent, refName, extendHierarchy as named parameters
so the argument order matches VirtualBuilderWidget's constructor.
No description provided.