compileDslBoolValueForExistingWidgetClass function

FFBooleanValue compileDslBoolValueForExistingWidgetClass(
  1. FFProject project, {
  2. required String widgetClassName,
  3. required String targetNodeKey,
  4. required DslExpression expression,
})

Compiles a DSL expression into an FFBooleanValue for an existing node.

Implementation

FFBooleanValue compileDslBoolValueForExistingWidgetClass(
  FFProject project, {
  required String widgetClassName,
  required String targetNodeKey,
  required DslExpression expression,
}) {
  final context = _buildExistingWidgetClassCompileContext(
    project,
    widgetClassName: widgetClassName,
  );
  final target = findByKey(context.widgetClass.node, targetNodeKey);
  if (target == null) {
    throw ArgumentError(
      'Target node "$targetNodeKey" was not found on "$widgetClassName".',
    );
  }
  final env = _configureExistingNodeEnv(context, target);
  return context.compiler.compileBoolValue(expression, env);
}