mix_generator library

Code generators for Mix specs, stylers, mix values, and widget wrappers.

This package generates the following artifacts:

  • Spec mixin _$XSpec: self-contained — implements Spec<X> and Diagnosticable; inlines ==, hashCode, toString, getDiff, toDiagnosticsNode, debugFillProperties, plus copyWith, lerp, props, and type.
  • Styler mixin _$XStylerMixin: setters, base methods (animate, variants, wrap, modifier), merge, resolve, debugFillProperties, props.
  • Mix mixin _$XMixin: merge, resolve, props.
  • Widget wrapper class X extends StatelessWidget for a Style<S> factory annotated with @MixWidget.

Classes

CompoundStylerPartDescriptor
Describes one nested styler section inside a compound styler.
CompoundStylerSurface
Curated compound styler surface.
FieldAliasConfig
Field alias mappings for diagnostics and setters.
FieldModel
A Spec field with derived type, interpolation, and diagnostic metadata.
ForwarderGroup
A group of named factories derived from owner mixin methods.
KnownMixSymbolResolver
MixableGenerator
Source-gen generator that emits _$<Name>Mixin for @Mixable-annotated Mix<T> subclasses.
MixFieldModel
A Mix field with names and type code ready for generated output.
MixMixinBuilder
Builds the _$XMixin for a Mix class.
MixWidgetBuilder
Builds the StatelessWidget wrapper for a @MixWidget-annotated factory.
MixWidgetGenerator
MixWidgetModel
The complete shape of a generated @MixWidget class.
ModifierFieldModel
Represents a field from a WidgetModifier for code generation.
ModifierGenerator
Main generator for ModifierMix class code.
ModifierMixBuilder
Builds a full ModifierMix class from modifier field models.
ModifierMixinBuilder
Builds the _$XModifier mixin for a WidgetModifier class.
SpecGenerator
Source-gen generator for Mix Spec code.
SpecMixinBuilder
Builds the _$XSpec mixin for a Spec class.
SpecStylerGenerator
StylerConstructorParamDescriptor
A named parameter forwarded into a nested styler constructor.
StylerFactoryDescriptor
A generated named factory constructor descriptor.
StylerFactorySurfaceEntry
One ordered factory entry in a styler surface.
StylerFieldModel
A Styler field with derived setter, type, and diagnostic metadata.
StylerGenerator
Source-gen generator for legacy handwritten Mix Styler code.
StylerMethodDescriptor
A generated instance method descriptor.
StylerMixinBuilder
Builds the _$XStylerMixin for a Styler class.
StylerSurface
Curated styler public surface.
TypeMetadata
Metadata for a single Dart type name.
WidgetCallParam
One parameter forwarded through generated widget/call APIs.

Enums

DiagnosticKind
Kind of diagnostic property to use.
LerpStrategy
Lerp strategy for a field.
PropWrapperKind
Kind of Prop wrapper to use for a modifier field.
TypeCategory
How a type should be treated for interpolation and diagnostics.

Constants

fieldAliasMap → const Map<String, FieldAliasConfig>
Field aliases keyed by StylerName.fieldName.
flagPropertyDescriptions → const Map<String, String>
Curated FlagProperty.ifTrue strings keyed by field name.
listElementMixTypeMap → const Map<String, String>
Map from Flutter list element types to Mix element types.
listMixTypeMap → const Map<String, String>
Map from Mix element types to their generated list-mix types.
mixPublicImport → const String
rawListTypes → const Map<String, String>
Raw list types that are not wrapped in Prop<>.
typeMetadata → const Map<String, TypeMetadata>
Type metadata keyed by analyzer display name.

Functions

animateFactoryDescriptor() StylerFactoryDescriptor
Static animate factory descriptor.
compoundStylerSurfaceFor(String stylerName) CompoundStylerSurface?
Returns curated compound surface metadata for stylerName.
deriveStylerName(String specName) String
Derives the canonical Styler name for specName.
diagnosticKindFor(String typeName, {required bool isList}) DiagnosticKind
Returns the diagnostic property kind for typeName.
extractSpecFields(ClassElement classElement, String specName) List<FieldModel>
Extracts FieldModels from the unnamed constructor of classElement.
flagDescriptionFor(String fieldName) String?
The curated bool flag description for fieldName, if one exists.
generateLerpCode(FieldModel field) String
Generates the lerp code for a field.
generateSpecDiagnosticCode(FieldModel field) String
Generates the diagnostic property code for a Spec field.
iconShadowFactoryDescriptor() StylerFactoryDescriptor
Curated single-shadow factory for icon stylers.
iconShadowMethodDescriptor() StylerMethodDescriptor
Curated single-shadow method for icon stylers.
isEnumType(String typeName) bool
Whether typeName is a curated enum type.
isLerpableType(String typeName) bool
Whether typeName should be interpolated with MixOps.lerp.
isRawListField(String fieldName) bool
Whether fieldName is emitted as a raw list instead of Prop<>.
isSnappableType(String typeName) bool
Whether typeName should snap with MixOps.lerpSnap.
listElementMixTypeFor(String typeName) String?
The Mix element type for a Flutter list element type.
listMixTypeFor(String typeName) String?
The list-mix type for a Mix element type.
mixableGenerator(BuilderOptions _) → Builder
Builder factory for mixable_generator.
mixGenerator(BuilderOptions _) → Builder
Builder factory for mix_generator.
mixTypeFor(String typeName) String?
The Mix counterpart for typeName, if one exists.
mixWidgetGenerator(BuilderOptions _) → Builder
Builder factory for mix_widget_generator.
modifierGenerator(BuilderOptions _) → Builder
Builder factory for modifier_generator.
ownerMixinsFor(String typeName) List<String>
The styler mixins that own fluent methods for typeName.
planStylerApi({required String stylerName, List<ApiMember> fieldFactories = const [], List<StylerFactoryDescriptor> curatedFactories = const [], List<StylerMethodDescriptor> curatedMethods = const [], Set<String> generatedSetterNames = const {}}) → ({List<String> factoryCodes, List<String> methodCodes})
Converts curated descriptors and generated field members into validated styler API code in emission order.
rawListElementTypeFor(String fieldName) String?
The raw list element type for fieldName, if curated.
resolveLerpStrategy(FieldModel field) LerpStrategy
Resolves the lerp strategy for a field.
specStylerGenerator(BuilderOptions _) → Builder
Builder factory for spec_styler_generator.
stylerGenerator(BuilderOptions _) → Builder
Builder factory for styler_generator.
stylerSurfaceFor(String stylerName) StylerSurface?
Returns curated surface metadata for stylerName.
suppressedFieldFactoryNamesFor(String stylerName) Set<String>
Field-backed factories intentionally suppressed for stylerName.
textDirectiveFactoryDescriptors() List<StylerFactoryDescriptor>
Curated text directive factories.
textDirectiveMethodDescriptors() List<StylerMethodDescriptor>
Curated text directive methods.
transformAnchorFactoryDescriptor() StylerFactoryDescriptor
Transform factory emitted when a styler has a transform anchor.
transformAnchorMethodDescriptor() StylerMethodDescriptor
Transform anchor method emitted for non-compound transform stylers.

Typedefs

ApiMember = ({String code, String name})
Concrete generated API member code keyed by public member name.