Skip to content

Read the home widget JSON spec with the shared SpecJsonReader - #4

Merged
ayushflow merged 1 commit into
mainfrom
ayush/home-widget-spec-json-reader
Nov 30, 2026
Merged

ayushflow merged 1 commit into
mainfrom
ayush/home-widget-spec-json-reader

Conversation

@ayushflow

Copy link
Copy Markdown
Contributor

Description

homeWidgetAppFromJson had its own copy of the small JSON reader that the layout JSON and flutterflow_live_activity already share (SpecJsonReader in flutterflow_native_layout). It now uses the shared one, which removes about 90 lines of duplicated reader code.

No behaviour change:

  • HomeWidgetJsonException is still thrown, with the same path and message and the same toString().
  • New test/json_errors_test.dart pins the path and message of 24 kinds of invalid input (spec, widget, value, layout size, layout, refresh, configuration). The pins were captured on v0.3.0 and pass unchanged.
  • Files generated from example/widgets.json and from a spec that also has refresh and configuration are byte-identical to v0.3.0, as is the JSON round trip.
  • Tests pass in all three packages; dart analyze --fatal-infos and dart format are clean.

CHANGELOG: one line under Unreleased.

🤖 Generated with Claude Code

The spec reader had its own copy of the reader the layout JSON and the Live
Activity package already share. It now uses SpecJsonReader; errors are
rethrown as HomeWidgetJsonException with the same path and message.

A new test pins the message and path of every kind of invalid input, and the
generated files and the JSON round trip match v0.3.0 byte for byte.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ayushflow
ayushflow requested a review from sbis04 November 27, 2026 18:46

@sbis04 sbis04 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Checked:

  • test/json_errors_test.dart run against main's json.dart: all 24 pass, so paths and messages are unchanged.
  • Files generated from example/widgets.json and from a probe spec (countdowns, fill/fixed images, \r text): identical on main and on this branch.
  • dart test and dart analyze --fatal-infos clean.

@ayushflow
ayushflow merged commit 856de5c into main Nov 30, 2026
1 check passed
@ayushflow
ayushflow deleted the ayush/home-widget-spec-json-reader branch November 30, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants