Skip to content

Support ViewModel Reassignment on CurrentWidget Rebuilds - #17

Merged
jshep23 merged 9 commits into
3.0.0from
ViewModelReassignmentSupport
Apr 18, 2026
Merged

jshep23 merged 9 commits into
3.0.0from
ViewModelReassignmentSupport

Conversation

@jshep23

@jshep23 jshep23 commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces several improvements and updates to both the example app and the core library. The most significant changes include enhancing the counter example with a form for direct count input, updating SDK and dependency versions, clarifying error messages and documentation around view model assignment, and improving property reactivity. There are also minor updates to macOS deployment targets.

Example App Enhancements:

  • Added a Form with a TextFormField to the counter example, allowing users to set the counter value directly by entering a number. This form is managed with a new formKey. [1] [2] [3] [4]

Dependency and Platform Updates:

  • Updated the Dart SDK constraint to >=3.0.0 <4.0.0, bumped the uuid and flutter_lints package versions, and updated the macOS deployment target from 10.14 to 10.15. [1] [2] [3] [4]

Error Handling and Documentation Improvements:

  • Improved the CurrentViewModelAlreadyAssignedException message to provide clearer guidance and actionable steps, especially regarding widget rebuilding and use of AutomaticKeepAliveClientMixin. [1] [2]
  • Enhanced documentation and naming in CurrentViewModel to clarify that assignment is to a CurrentState (not just a widget), and improved the logic to prevent multiple assignments. [1] [2] [3]

Reactivity Improvements:

  • Added a setter for the value property in CurrentProperty that updates the value and triggers UI updates only when the value actually changes, with clear documentation on its behavior.

@jshep23
jshep23 merged commit 997846b into 3.0.0 Apr 18, 2026
3 checks passed
@jshep23
jshep23 deleted the ViewModelReassignmentSupport branch April 18, 2026 17:47
jshep23 added a commit that referenced this pull request Apr 28, 2026
* Support ViewModel Reassignment on CurrentWidget Rebuilds (#17)

* Added option to allow reassigning an existing view model to an new instance of a widget

* Assign the ViewModel to the hash of the state instead of the CurrentWidget

* Fix assignedTo check in ViewModel

* Update the already assigned exception to explain steps the user can take to support reassignment of view models

* Grammar...

* Grammar...

* Format exception message

* Add documentation to CurrentState

* Allow setting CurrentProperty by directly setting the value

* Enhance State Change Handling (#18)

* Changed StateChanged Stream to a single Event broadcaster

Added listenable support to busy status changes

* Updated example app to use new state changes

* Expand ErrorEvent handling options. Allow specific subscribing, and handling internal errors

* Add error handling example to example application

* Added isDirty property. Added factory shorthands for current specific primary property types

* Export CurrentClonable

* Update example view model to use new shorthand factory

* Added calculated isDirty getter to CurrentViewModel

* Add tests for isDirty prop

* Add docs to new BusyStatusChanged event

* Current Text Controller (#19)

* Implemented controller. Fixed vm reset not clearing busy status.

* Added CurrentTextController to Example project

* Fix type check on date time controller

* Fix default value, and hash equality assignments and checks

* Updated text field carrot snapback to select text when backspacing on a non-null field

* Fix date time asString when cant be parsed. added tests for other supported types

* Fix issue when resetting view model or using setMultiple manually. add test

* Update example. Added missing test.

* Clean up

* Make example page scrollable

* Add seperate custom and any state change listener

* Add seperate custom and any error event listeners

* Fix issue where lists and maps marked as dirty on initial set.

* Fixed an issue where calling resetAll on the view model behaved differently for lists and maps

* Report prop name and hash on list/map change. report inserted item instead of whole list. added tests

* Optionally allow external / parent widget to handle viewmodel lifecycle.

* Fix issue where setMultiple always issued notifications, even if nothing actually changed.

* Update value equality implementation. This fixes issues with map keys, and odd comparison results. Updated stale test descriptions.

* deprecated math functions on int property (generics were odd since you can't impl num)

* added tests for the new int property functions.

* added tests to cover null scenarios in double property math functions

* Current Validation & Revamp Example App (#20)

* Clean up statle documentation

* added current validation state. added additive extension (nonbreaking).

* add docs to new current validation classes. fix docs in view model. export current validation

* add some docs around the _omitted internal variable. added unit tests

* progress on integrating current validation with new current text controller.

* Add option to localize default validation errors

* Add additional docs to the current text controller

* update core web files for example app

* Progress on new space themed example app. added logos. removed old example page

* added flight forms page. redfactored app view model

* added launch missing, map and telemetry examples

* added widget tests

* add third version branding

* Move viewmodels out of widget pages

* clean up

* clean up

* clean up

* add code examples to example app. add link to third version website

* Restructure validation results to produce typed issues. This is to support localization without coupling ui to view models

* Update Readmes

* Change current validation to explicit opt in. Reduces footguns. Update docs and examples.

* clean up example propery initialization

* Clean up validation registration. better support context based localization

* Remove unused mixin. Remove tests

* Tie validation execution to TextFormFields. Added convenience Current text widgets without losing native support

* Added tests for text form field integration

* Update readme

* add convenience setter functions for various properties

* Rename factories on CurrentTextController for consistency

* 3.0.0 Beta 1 (#21)

* bump version, generate docs

* Add changelog entry

* Improve DX When Binding CurrentTextControllers (#23)

* Add type specific controllers to tighten api around binding

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant