mix_generator 2.2.0
mix_generator: ^2.2.0 copied to clipboard
A code generator for Mix, an expressive way to effortlessly build design systems in Flutter.
2.2.0 #
Stable release of the 2.2.0 line. Cumulative since 2.1.3:
- FEAT: Generate
@MixWidget(target:)wrappers for plain Widget constructors without requiringStyleWidgetor extensioncall()methods. Preserve target generics, key/default forwarding, enum variant constructors, independent widget/factory parameter curation, and clean same-build generated Styler support. - FEAT: Emit a complete
$stylerFieldNamesinventory for generated Stylers so schema tooling can validate field coverage directly from runtime classes.stylerFieldNamesis now reserved, with a targeted diagnostic, and generated field-name literals safely escape$identifiers. Generated output requires Mix 2.2.0 or newer. - FEAT: Forward canonical named factories and matching fluent anchors from
nested
StyleSpec<XSpec>fields with@MixableField(forwardStyler: true). A source-SpecstylerSurfaceoverride supports compatible restricted surfaces without resolving same-package generated Stylers, with field-located diagnostics for invalid or ambiguous configurations (#983). - FIX: Accept visible typedefs in generated library scope whose expansion names hidden types (#1058).
- FIX: Drop redundant
thisqualifiers from generated@MixWidgetbuild methods. The unused build parameter is now the wildcardBuildContext _, so a field namedcontextstill forwards the widget's own value instead of the build context. The values forwarded to the target constructor or factory are unchanged. - FIX: Preserve type parameters and bounds from uninstantiated generic
targets in generated
@MixableSpec(target:)call()methods, and reject instantiated or aliased generic targets instead of silently widening them in@MixableSpec(target:)or@MixWidget(target:). Reject a target type parameter namedKeywhen it would shadow the generated Flutter key parameter (#1023). - FIX: Allow
@MixableSpec(target:)to use plain Widget constructors whose namedstyleparameter accepts the generated Styler, without requiring the target to extendStyleWidget(#1022). - FIX: Generate
@MixWidgetwrappers on clean builds when a factory returns a Styler generated by a same-library@MixableSpec(#995). - FIX: Render forwarded nested Styler APIs in the host library scope,
delegate restricted aliases through the actual nested implementation,
validate custom forwarding
setterTypeconstruction and method compatibility, and reject collisions with inheritedMixStylermembers.
2.2.0-beta.4 #
- FIX: Drop redundant
thisqualifiers from generated@MixWidgetbuild methods. The unused build parameter is now the wildcardBuildContext _, so a field namedcontextstill forwards the widget's own value instead of the build context. The values forwarded to the target constructor or factory are unchanged.
2.2.0-beta.3 #
- FEAT: Emit a complete
$stylerFieldNamesinventory for generated Stylers so schema tooling can validate field coverage directly from runtime classes.stylerFieldNamesis now reserved, with a targeted diagnostic, and generated field-name literals safely escape$identifiers. Generated output requires Mix 2.2.0-beta.5 or newer. - FIX: Preserve type parameters and bounds from uninstantiated generic
targets in generated
@MixableSpec(target:)call()methods, and reject instantiated or aliased generic targets instead of silently widening them in@MixableSpec(target:)or@MixWidget(target:). Reject a target type parameter namedKeywhen it would shadow the generated Flutter key parameter (#1023). - FIX: Allow
@MixableSpec(target:)to use plain Widget constructors whose namedstyleparameter accepts the generated Styler, without requiring the target to extendStyleWidget(#1022).
2.2.0-beta.2 #
- FEAT: Generate
@MixWidget(target:)wrappers for plain Widget constructors without requiringStyleWidgetor extensioncall()methods. Preserve target generics, key/default forwarding, enum variant constructors, independent widget/factory parameter curation, and clean same-build generated Styler support.
2.2.0-beta.1 #
- FIX: Generate
@MixWidgetwrappers on clean builds when a factory returns a Styler generated by a same-library@MixableSpec. The generator now derives the call surface from the spec'starget:constructor while preserving widget-parameter curation, key forwarding, enum variants, and unmatched-type diagnostics (#995).
2.2.0-beta.0 #
- FEAT: Forward canonical named factories and matching fluent anchors from
nested
StyleSpec<XSpec>fields with@MixableField(forwardStyler: true). A source-SpecstylerSurfaceoverride supports compatible restricted surfaces without resolving same-package generated Stylers, with field-located diagnostics for invalid or ambiguous configurations (#983). - FIX: Render forwarded nested Styler APIs in the host library scope,
delegate restricted aliases through the actual nested implementation,
validate custom forwarding
setterTypeconstruction and method compatibility, and reject collisions with inheritedMixStylermembers.
2.1.3 #
- FEAT: Support
@MixWidget(widgetParameters: .only({...}))for a stable, curated generated widget value-parameter API. Factory parameters, validKey? keyforwarding, and method-level type parameters remain automatic; excluded optional parameters use the styler method's defaults and are not validated for generated-widget visibility or name collisions. Annotations from oldermix_annotationsreleases retain.all()behavior.
2.1.2 #
- FEAT: Generate one named widget constructor per accessible enum value
when an
@MixWidgetfunction has a named, non-nullable enum parameter namedvariant(for example,Button.solid(...)). The existing unnamed constructor remains unchanged. - FEAT: Derive nested styler types for
StyleSpec<XSpec>spec fields by theXSpec -> XStylernaming convention. Generated spec stylers now expose styler-typed constructors, setters, and field factories withProp.maybeMixmerge semantics for nested specs without requiring@MixableField(setterType:)— including same-package generated stylers, which annotation type arguments can never resolve during generation.setterTypestill overrides the convention. Breaking for specs that relied on nestedStyleSpecconstructor params being raw resolved values: pass the corresponding styler instead. - FIX: Allow
@MixWidgetto generate widgets from generic stylercall<T>()methods, preserving type parameter bounds and forwarding type arguments to the styler call.
2.1.1 #
- FEAT: Support
@MixableField(setterType:)on@MixableModifierfields. GeneratedModifierMixconstructors accept the declared Mix type and wrap values withProp.maybeMix(#950). - FEAT: Support
@MixableField(setterType:)on@MixableSpecfields. Generated spec stylers expose Mix-typed setters and field factories for nestedStyleSpecfields (#951).
2.1.0 #
- FEAT: Add
@MixableModifiergenerator. Annotate aWidgetModifiersubclass to generate its modifier mixin andModifierMixclass. Requiresmix_annotations^2.1.0(#924). - FEAT: Generate spec stylers with parity coverage, emitting styler methods that match the spec's resolvable surface (#923).
- TEST: Cover the single-field
debugFillPropertiescascade in generated output (#942). - FEAT: Add
@MixWidgetgenerator. Annotate a top-levelfinalstyler variable or a styler-returning function; the generator emits aStatelessWidgetwhosebuild()delegates to that styler'scall(). Constructor parameters mirror the styler'scall()signature, withKey? keyforwarded viasuper.key. - CHORE: Match Flutter's canonical
Keytype viaTypeCheckerinstead of comparing parameter type names. The stylercall()may declare exactlyKey? key(named, nullable, no default, notrequired) to opt intosuper.keyforwarding. Any otherkey-named parameter — subclasses such asLocalKey?/GlobalKey?, non-nullableKey, positional, defaulted, or akeyparameter on the factory function — is rejected with anInvalidGenerationSourceerror. - CHORE: Generated
build()now forwards every constructor field asthis.<name>so user parameter names cannot be shadowed bybuild()'s localcontextor by the factory reference. Parameter names matching the factory identifier or inheritedStatelessWidget/Widget/Objectmembers (build,createElement,runtimeType,hashCode,toString,noSuchMethod) are now rejected withInvalidGenerationSource. - CHORE:
@MixWidget(name: '...')overrides are validated as Dart class identifiers; non-identifier shapes and Dart reserved words are rejected. - CHORE: The annotated library must import
package:flutter/widgets.dartwithout a prefix. Prefixed Flutter imports are rejected with a clear error pointing to the unprefixed import (or a barrel re-export). - CHORE:
@MixWidgetrequires the annotated element's name to belowerCamelCaseending inStyle. Names that don't match are rejected; use@MixWidget(name: '...')to override. - FEAT: Emit a
@Deprecated typedef _$<Name>SpecMethods = _$<Name>;alongside every@MixableSpecmixin so legacyclass X extends Spec<X> with Diagnosticable, _$XSpecMethodsdeclarations keep compiling against the 2.0+ generator. Removal scheduled formix_generator3.0. - CHANGED: Under the legacy declaration shape,
toString()now routes throughDiagnosticable.toDiagnosticsNode, replacing Equatable'sX(field: …)format with Flutter's diagnostic-node format. Update any tests that pinned the old string. - CHORE: Drop unused direct dependencies (
collection,build_config,logging,path); the generator no longer references them. - FIX:
GeneratedSpecMethods.skipEqualsnow only suppressespropsgeneration. The rest of the equality surface (==,hashCode,getDiff,stringify) is always emitted, preserving the supported "user authorsprops" flag semantic after the spec-shape refactor. - FIX:
Prop<T>detection now uses a URL-basedTypeChecker(package:mix/src/core/prop.dart#Prop) instead of matching on the simple nameProp. Prevents unrelated local classes namedPropfrom being mistaken for Mix'sProp. - FIX:
@Mixablevalidation now requires the annotated class to extendMix<T>(or a subclass) directly. Classes extendingMixable<T>without going throughMix<T>are rejected with a clear error — the generated mixin'son Mix<T>constraint would have failed at apply time anyway. - TEST: Consolidate generator test helpers (
partBuilder,styleStub,mixElementStub,propStub,mixAnnotationsSources) intotest/core/test_helpers.dart. Adds regression tests forskipEquals, fake-Prop<T>rejection, andMixable<T>-direct-subclass rejection.
2.0.1 #
- REFACTOR: Tighten field-model validation and shared type-helper extraction across mix/styler generators (#895).
- TEST: Add generator smoke and validation integration tests plus broader builder coverage (#895).
2.0.0 #
- Stable release matching the
2.0.0-rc.1surface, with READMEs refreshed for the 2.0 generator API (#887, #888).
2.0.0-rc.1 #
- BREAKING: The Mix Generator was completely rebuilt to support the architecture and requirements of Mix V2.0.
- FEAT: Support Style class extensions in code generation (#845).
- FEAT: Add MixableSpec, MixableStyler, and code generation for properties (#835).
- FIX: Respect nullability in lerp resolver.
- FIX: Make copyWith parameters nullable (#848).
1.7.0 #
- REFACTOR: Rename WidgetModifiersData to WidgetModifiersConfig (#649).
- REFACTOR: Fix deprecations and modernize codebase (#647).
- FIX: update animated property handling to use null coalescing (#637).
- FEAT: Add generated style-focused modifiers and specs (#652).
- FEAT: unify SpecUtility, Style, and Attributes as compatible values (#643).
- FEAT: builder optimization (#629).
0.4.0 #
- REFACTOR: Rename
MixablePropertytoMixableType(#574) - REFACTOR: mix generator clean up and mix semantic changes (#569)
- CHORE: Update min version compatibility (#572)
0.3.2 #
- REFACTOR: Rewrite Fortaleza theme using the new code gen for tokens (#528).
- FIX: Shadow list animation (#445).
- FEAT: Create code gen for design tokens (#521).
- FEAT: Rewrite FlexBox as a Mix's primitive component (#517).
- FEAT: Fluent API (#475).
- FEAT: Remix improvements and further improvements (#410).
- DOCS: improve mix theme data features explanations (#404).
0.3.1 #
- FEAT: Fluent API (#475).
0.3.0 #
- FIX: SpecModifiers were taking a long time to animate. (#457).
- FIX: Shadow list animation (#445).
0.2.2+1 #
- DOCS: improve mix theme data features explanations (#404).
0.2.2 #
- FEAT: Code generation for Widget Modifiers (#396).
- FEAT: Dto utility generation now adds constructor and static methods (#377).
- FEAT: ColorSwatchToken and other token improvements (#378).
- REFACTOR: Code gen more lint friendly dart code (#399) and (#395).
- FIX: Nullable merge expressions and updates debug properties (#392).
0.2.1 #
- REFACTOR: bump flutter version to 3.19.0 (#365).
- FEAT: modifiers in spec (#333).
0.2.0 #
- Fixed: issue with getting correct type override from MixableDto
- Improved: Dto resolved type look up logic
- Added: generation List of value extension of a Dto
- Added: Class and Enum utility generation
0.1.2 #
- Fixed: Resolved conflict on generators when not configured on build.yaml
0.1.1 #
- Added: Support for Spec Attributes
0.1.0 #
- Initial release.