Repository navigation
Migrate from codelessly_json_annotation to json_annotation - #34
Merged
Merged
Conversation
Replace codelessly_json_annotation / codelessly_json_serializable with json_annotation 4.12 and json_serializable 6.14, which build on Dart 3.13. The fork omitted fields equal to their constructor default from toJson. Keep that output identical with a small dev-only builder in tool/json_defaults_builder that generates _$XOmitDefaults(instance, json) per class; toJson now calls _$XOmitDefaults(this, _$XToJson(this)). JsonKey.excludeIf becomes @JsonOmitIf, the fork's DateTime converter is vendored in converters.dart, and useDynamics is dropped. Golden tests pin toJson output and round-tripping against JSON produced by the 4.4.0 fork-based build. Also bumps the SDK constraint to ^3.13.0, equatable 3, lints 6 and other dependencies to their latest versions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
- Ignore must_be_immutable: nodes are mutable by design and Equatable 3 is @immutable. - Fix TypedValue.toEdgeInsetsModel, whose type-literal patterns compared against the Type objects and never matched. - Drop @OverRide on factories, a dead null-aware fallback, and the deprecated Matrix4.translate; use initializing formals and document the remaining public members. - Reformat with the Dart 3.13 formatter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
- ListTileNode.empty/fromProperties and ExpansionTileNode.empty left late fields unset and threw on first access. ExpansionTileNode.empty also reused the list tile id and name. - FloatingActionButtonNode.empty and EmbeddedVideoNode.empty used the switch and slider preview sizes. - Remove the blend and value constructor parameters that LoadingIndicatorNode, ProgressBarNode and DividerNode accepted and discarded. - copyWith dropped Divider thickness, Dropdown enabled/dense/expanded/ autoFocus/enableFeedback, FAB location and M2 navigation bar notch settings. - props omitted fields, so changed properties compared equal: ExpansionTile (all), grid delegate spacing, Dropdown, Divider, FAB, ListTile visibility flags, TabBar indicator shape, icon scale, the shared WebView settings, submit action service and Mailchimp fields, Vimeo metadata, condition group name and visual density type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
- TextAlignHorizontalEnum: start, end (RTL-aware TextAlign values). - ButtonTypeEnum: filled, filledTonal (FilledButton). - AutovalidateModeC: onUnfocus, onUserInteractionIfError. - FABLocation: endContained. - TextInputTypeEnum: webSearch, twitter. - SliderTrackShapeEnum: gapped; SliderValueIndicatorShape: drop, roundedRectangle (Material 3 slider shapes). - CShapeBorder: roundedSuperellipse (RoundedSuperellipseBorder). Additions only, so existing JSON reads unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
- InputDecorationModel.contentPadding, which copyWith already accepted and silently dropped. - MultiSourceIconModel fill, weight, grade and opticalSize, the variable-font axes Material Symbols need. - AppBarProperties foregroundColor and scrolledUnderElevation. - TabBarProperties tabAlignment (new TabAlignmentC enum) and dividerHeight. All are optional and null by default, so existing JSON is unchanged. Also document the Flutter replacements for the deprecated scroll view cacheExtent (scrollCacheExtent) and Radio.groupValue (RadioGroup). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
TextFieldNode was the only custom node without a 'properties' field accessor, and TextFieldProperties had no FieldsHolder at all. The M2 and M3 navigation bar properties only exposed the shared notch and item fields, not their own colors, label styles, icon sizes, elevation and layout options. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
A text field node's padding is already rendered as the decoration's content padding, so a separate field would conflict with it. Remove the ignored copyWith parameter instead and document where the padding lives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
The SDK renders icons as SVGs and does not render Material Symbols yet, so fill/weight/grade/opticalSize would be stored but never applied. Add them together with Material Symbols rendering instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
Stored JSON omits fields equal to their default, so changing a default would silently restyle every saved design. Keep the old value as the read default (@jsonkey(defaultValue: ...) for literals, the new @JsonLegacyDefault plus readValue for objects) and let the defaults builder omit fields only when they equal that old value. New nodes get Material 3 values and write them explicitly. Changed: Switch useMaterial3, button shape and preferred padding, FAB shape/radius/elevations/icon spacing and extended size, list and expansion tile padding, tab indicator size, and navigation bar elevation. The golden test now checks that 4.4.0 JSON re-serializes unchanged and pins the output for new nodes in a second fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
Radio side/innerRadius/backgroundColor; Slider showValueIndicator, secondaryTrackValue, secondaryActiveTrackColor and padding; ListTile minTileHeight and titleAlignment; CircularProgressIndicator strokeAlign and trackGap; ExpansionTile showTrailingIcon; Text softWrap. New enums ShowValueIndicatorC and ListTileTitleAlignmentC. All optional with Flutter's defaults, so existing JSON is unchanged. Button minimumSize/fixedSize stay out: the node's box sizes the button. Also run CI on pushes to every branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
Document in the README which Flutter parameters are represented elsewhere or cannot be JSON. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
The SDK now renders Material Symbols from Google's prebuilt SVGs, whose URLs encode weight, grade, fill and optical size, so fill, weight, grade and opticalSize on MultiSourceIconModel have a renderer again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
Layouts containing a placeholder node failed to load because NodeJsonConverter had no deserializer for its type. A new test checks that every node type declared in the package is registered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
rayliverified
pushed a commit
to Codelessly/CodelesslySDK
that referenced
this pull request
Oct 13, 2026
The API changes are merged (Codelessly/CodelesslyAPI#34). Keep the git override until codelessly_api 5.0.0 is published to pub.dev. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
rayliverified
added a commit
that referenced
this pull request
Oct 13, 2026
Move off the forked JSON codegen to json_annotation/json_serializable with a small defaults builder that keeps stored JSON unchanged; mirror current Flutter widget parameters and enums; default new nodes to Material 3 while legacy JSON keeps its look; fix uninitialized nodes, lossy copyWith and incomplete equality; register PlaceholderNode; add CI and tests. Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
rayliverified
added a commit
that referenced
this pull request
Oct 13, 2026
Move off the forked JSON codegen to json_annotation/json_serializable with a small defaults builder that keeps stored JSON unchanged; mirror current Flutter widget parameters and enums; default new nodes to Material 3 while legacy JSON keeps its look; fix uninitialized nodes, lossy copyWith and incomplete equality; register PlaceholderNode; add CI and tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR migrates the codelessly_api package from the forked
codelessly_json_annotationpackage to the standardjson_annotationpackage. It also introduces a custom JSON defaults generator to handle omitting default values from serialized JSON.Key Changes
codelessly_json_annotationwithjson_annotationacross the codebasejson_defaults_builder) that generates_$<ClassName>OmitDefaultsfunctions to remove default values from JSON serialization, reducing payload size.g.dartfiles to use the newJsonDefaultsGeneratorinstead ofJsonSerializableGeneratorEmbeddedVideoSource,TextAlignVerticalEnum)EquatableMixintoEquatablein paint.dart and node_box.dartbuild.yamlto usejson_serializablebuilder instead ofcodelessly_json_serializableImplementation Details
json_defaults_buildertool generates helper functions that intelligently remove fields with default values before JSON serializationisJsonDefault()helper function with type-specific comparisonsexcludeConstraintsIf()functionhttps://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY