Skip to content

Schema

Alongside inflaters, the generator produces XSD schemas in the .xwidget/ config directory: fragments_schema.g.xsd (generated from your inflaters), plus routes_schema.g.xsd and values_schema.g.xsd for routes and values documents, and schema_catalog.g.xml — an XML catalog mapping each XWidget namespace to its schema. Together they provide IDE code completion and validation when editing XML.

What It Provides

When registered with your IDE, the generated schema enables:

  • Autocomplete for widget element names
  • Autocomplete for attribute names and enum values
  • Inline documentation from Flutter's doc comments
  • Validation of attribute names and types

Configuration

schema:
  template: "xwidget_builder|res/schema_template.xsd"

  types:
    "bool": "boolAttributeType"
    "Alignment": "AlignmentAttributeType"
    "Curve": "CurvesAttributeType"

  attribute_exclusions: [
    "*:child",
  ]

template — XSD template file that provides the schema skeleton. Defaults to xwidget_builder|res/schema_template.xsd.

types — maps Dart types to XSD simple types for attribute validation. This controls how attribute values are validated in the IDE.

attribute_exclusions — attributes to omit from the schema. Format: ClassName:attrName. Use * for the class name to match any class.

IDE Integration

No setup is needed in the supported IDEs. IntelliJ resolves the schemas through its namespace index the moment they exist in the project; the VSCode extension registers schema_catalog.g.xml with the Red Hat XML extension automatically. For any other editor, register the catalog (or the individual schemas) using your editor's XML catalog support — resolution is by namespace, so file location doesn't matter.