onUIEvent method
Process UI event and execute rules
Implementation
Future<void> onUIEvent({
String? elementId,
String? widgetPath,
String? action,
Map<String, dynamic>? metadata,
}) async {
if (!_engine.isActive) return;
try {
final eventContext = EventContext(
elementId: elementId,
widgetPath: widgetPath,
action: action,
metadata: metadata,
);
final rulesContext = UIRulesContext(
event: eventContext,
appContext: _appContext,
);
final result = await _engine.executeUIRules(rulesContext);
await _processRulesResult(result);
} catch (e) {
ObslyLogger.error('Error executing UI rules: $e');
}
}