Conversation
…yWith, and decode Replace manual ==, hashCode, and copyWith implementations across all core models with dart_mappable code generation. Add consistent parse() methods that validate via Ack schemas before construction. Introduce BlockDiscriminatorHook for legacy 'column' type compatibility and UnmappedPropertiesHook for dynamic args in WidgetBlock/SlideOptions.
…lideOptions Remove unused BlockX and StringContentX extensions. Add construction-time validation to SlideOptions that rejects reserved keys in args, matching the existing WidgetBlock behavior.
|
To view this pull requests documentation preview, visit the following URL: Documentation is deployed and generated using docs.page. |
Prevents runaway jobs from consuming GitHub Actions minutes. Based on observed run durations: test 15m, integration/web-smoke/firebase 20m, docs 5m.
There was a problem hiding this comment.
Pull request overview
Migrates SuperDeck core model classes to dart_mappable to reduce manual boilerplate (equality/hashCode/copyWith), while tightening/standardizing input parsing via Ack schema validation (parse()), and adding reserved-key protections for dynamic argument maps.
Changes:
- Refactor core models (
Deck,Slide, blocks, assets, deck configuration) to usedart_mappablegenerated mappers and generatedcopyWith/==/hashCode. - Introduce/standardize
parse()entrypoints that validate withAckschemas and add hooks/utilities for legacy discriminator compatibility and unmapped properties. - Update tests and call sites to account for non-const constructors and new validation/immutability behaviors.
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/superdeck/test/slide_template_test.dart | Update tests to remove const usage for Slide. |
| packages/superdeck/test/markdown/markdown_builders_test.dart | Update markdown builder test harness to use non-const Slide. |
| packages/superdeck/test/markdown/image_element_rendering_test.dart | Update image rendering tests to use non-const Slide. |
| packages/superdeck/test/markdown/builders/text_element_builder_widget_test.dart | Update text builder widget tests to use non-const Slide. |
| packages/superdeck/test/deck/template_resolver_test.dart | Update tests to remove const usage for SlideOptions. |
| packages/superdeck/test/deck/slide_configuration_builder_test.dart | Update slide configuration builder tests to use non-const slides and compact list literals. |
| packages/superdeck/lib/src/deck/slide_configuration.dart | Default slide options now constructed dynamically when absent. |
| packages/superdeck/lib/src/deck/bundled_deck_service.dart | Switch bundled deck loading to Deck.parse(...) validation. |
| packages/genui/test/presentation/thumbnail_preview_service_test.dart | Update thumbnail preview tests to use non-const slides. |
| packages/core/test/src/models/slide_model_test.dart | Update Slide/SlideOptions tests for non-const ctors; add immutability + reserved-key tests; switch to parse() where appropriate. |
| packages/core/test/src/models/deck_model_test.dart | Update Deck tests for unmodifiable slides and Deck.parse(...) validation expectations. |
| packages/core/test/src/models/block_model_test.dart | Adjust error expectations; add immutability + reserved-key tests; remove extension-related tests. |
| packages/core/test/src/models/asset_model_test.dart | Add parse() tests and immutability/schema tests for asset reference models. |
| packages/core/test/src/deck_service_test.dart | Update DeckService tests to use non-const Slide. |
| packages/core/pubspec.yaml | Add dart_mappable + builder deps (build_runner, dart_mappable_builder, ack_generator). |
| packages/core/lib/src/models/slide_model.mapper.dart | New generated dart_mappable mapper for Slide/SlideOptions. |
| packages/core/lib/src/models/slide_model.g.dart | Minor generator output adjustment (comment cleanup). |
| packages/core/lib/src/models/slide_model.dart | Refactor Slide/SlideOptions to dart_mappable, add unmodifiable collections, reserved-key validation, and schema-validating parse(). |
| packages/core/lib/src/models/mappers.dart | Add BlockDiscriminatorHook for legacy column discriminator normalization. |
| packages/core/lib/src/models/deck_model.mapper.dart | New generated dart_mappable mapper for Deck. |
| packages/core/lib/src/models/deck_model.dart | Refactor Deck to dart_mappable, make slides unmodifiable, and route validation through parse(). |
| packages/core/lib/src/models/block_model.mapper.dart | New generated dart_mappable mappers for blocks and enums. |
| packages/core/lib/src/models/block_model.dart | Refactor blocks/enums to dart_mappable, add parse() validation, add reserved-key protection for widget args, remove old extensions. |
| packages/core/lib/src/models/asset_model.mapper.dart | New generated dart_mappable mappers for asset models. |
| packages/core/lib/src/models/asset_model.dart | Refactor asset models to dart_mappable, add parse() and unmodifiable collections. |
| packages/core/lib/src/deck_service.dart | Switch file-based deck loading to Deck.parse(...) validation. |
| packages/core/lib/src/deck_configuration.mapper.dart | New generated dart_mappable mapper for DeckConfiguration. |
| packages/core/lib/src/deck_configuration.g.dart | Minor generator output adjustment (comment cleanup). |
| packages/core/lib/src/deck_configuration.dart | Refactor DeckConfiguration to dart_mappable while keeping existing parsing/validation utilities. |
| packages/core/build.yaml | Configure dart_mappable_builder generation options for the core package. |
| final data = jsonDecode(content) as Map<String, dynamic>; | ||
| return Deck.fromMap(data); | ||
| return Deck.parse(data); | ||
| } on Exception catch (e) { |
There was a problem hiding this comment.
jsonDecode(content) as Map<String, dynamic> can throw a TypeError if the JSON isn’t an object, and TypeError won’t be caught by the current on Exception handler. To ensure loadDeck() reliably returns an error deck (instead of crashing), either broaden the catch to on Object or validate the decoded value’s type before casting/parse.
| } on Exception catch (e) { | |
| } on Object catch (e) { |
| _widgets = widgets; | ||
|
|
||
| SlideOptions get options => _slide.options ?? const SlideOptions(); | ||
| SlideOptions get options => _slide.options ?? SlideOptions(); |
There was a problem hiding this comment.
options creates a new SlideOptions() instance every time it’s accessed when the slide has no options. Since this getter can be hit frequently during widget builds, consider caching a single empty instance (e.g., a static final empty options or a lazily initialized field) to avoid repeated allocations.
|
Visit the preview URL for this PR (updated for commit 4861984): https://superdeck-dev--pr53-leoafarias-dart-mapp-p1qltdqq.web.app (expires Fri, 10 Apr 2026 01:09:05 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: bd68fc230762285849207e7e120aaf87cd4ca2f9 |
Migrate core model classes to use dart_mappable for boilerplate reduction and consistency. Replace manual ==, hashCode, and copyWith implementations with generated versions. Add BlockDiscriminatorHook for legacy 'column' type compatibility and UnmappedPropertiesHook for dynamic args. Introduce consistent parse() methods that validate via Ack schemas. Remove dead extensions and add reserved-key validation to SlideOptions.
All tests passing (701 core, 651 superdeck, 428 genui).