Skip to content

Ack 2.0: primary-constructor models (analyzer 13.3, generator on Dart 3.13) #188

Open

Description

@leoafarias

Tracking issue for primary-constructor models, deferred from 1.7 to 2.0.

The work

#184 adds @Schemable() on a Dart primary constructor:

/// @description Which habit a screen is about.
@Schemable()
final class HabitDto({
  /// @description A saved habit's id.
  required final String habitId,
}) with _$HabitDtoAck;

Reading a primary constructor requires analyzer ^13.3.0, which moves ack_generator to Dart 3.13. Core ack keeps its Dart 3.9 minimum. That move is why this is held for 2.0.

What 1.7 takes from #184 instead

The analyzer-independent part lands separately in the 1.7 line: the annotations move into ack, the ack_annotations package is removed, and @Schemable() is the single annotation. #184 stays open for the rest.

Before this can merge

  • Rebase feat(ack)!: unify annotations and support primary constructors #184 onto main once the 1.7 part has landed, so it contains only the primary-constructor and analyzer changes.
  • Fix the "Minimum Dart SDK" check: Dart 3.9 flags doc-comment links to the deprecated annotations (ack_model.dart:16, schemable.dart:11). Until it passes, the Dart 3.13 generator job never runs in CI.
  • Add a generator test for a /// @description tag on a primary-constructor parameter and on the class.
  • Record in the changelog that the generated mixin's abstract getters require @override on a model's fields.
  • Format the branch with the Dart 3.13 formatter. About half of feat(ack)!: unify annotations and support primary constructors #184's current diff is that reformat; a first commit with only the toolchain bump and dart format keeps the rest reviewable.
  • Consumers that share a workspace with another generator need that generator on analyzer 13.3 too. mix_generator 2.2.0 declares analyzer >=9.0.0 <11.0.0, and it does not compile on 13.3 as is: FieldElement.isSynthetic was removed in analyzer 11 (mix_generator/lib/src/modifier_generator.dart:64).

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.0Planned for Ack 2.0enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions