Comments (5)
Cool, I'm happy with the verdict. reactive_forms_lbc
looks useful, cheers.
from reactive_forms_generator.
Do note that the required validator trims the white space so the value ' ' is indeed invalid, and I did 2 spaces so that it is different to the model and enters the important code in didUpdateWidget
.
from reactive_forms_generator.
It reconstructs only if
if (widget.model != oldWidget.model)
So if you are changing the model it means that this is new form so everything will be new
Implement proper object equality with equatable or freezed to have consistent behavior
from reactive_forms_generator.
I managed to change my app to make it work. I will ponder this form becoming pristine on model updates behaviour some more before I close.
I'm building a complex object by listening to formModel.form.valueChanges
, and my forms also need to read that complex object, so it listens to it and rebuilds.
It worked in version 0.24, but I think in version 1.0.0, when the form rebuilds, didUpdateWidget
is running with a different model (by one character), causing the reconstruction with pristine.
For my solution I don't update the complex object in formModel.form.valueChanges
anymore, so the form no longer rebuilds on value change. I do it on button presses, when it is okay to allow the form to be pristine, and also put the current form state that is missing from the complex object, in a separate object so I can get a full picture of the complex object now from 2 different objects.
from reactive_forms_generator.
There is https://pub.dev/packages/reactive_forms_lbc package which could help you to simplify listening
In overall it makes more sense to pass model into form and then operate the using form methods without resupplying the form with new model
from reactive_forms_generator.
Related Issues (20)
- How to properly dispose Form, dynamic fields/formgroup all at once? HOT 1
- How to use with freezed unions? HOT 3
- How to create a group that can be also a form in some situations. HOT 2
- There is a form.model getter? HOT 1
- [BUG] {Model}Form is generated for each file that use it as a import. HOT 6
- Unexpected warning message for nested form models HOT 6
- test HOT 4
- form.model is wrong when use a nested array of groups HOT 7
- [Feature Request] add submit method to FormModel HOT 3
- Shared models are generated twice HOT 4
- support for generics? HOT 6
- generated FormBuilder should call `initState` on `didUpdateWidget` HOT 3
- Generated classes missing the resetValue member HOT 12
- Example of a ReactiveFormsGenerator on ViewModel HOT 4
- The casing of key names of Form value is different from what Freezed package generated HOT 7
- The static formControlNames could be const HOT 2
- Validators set programmatically get cleared on didUpdateWidget HOT 1
- Programmatically Add controls HOT 2
- @FormArrayAnnotation() with inheritance HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactive_forms_generator.