Closed bzd2000 closed 4 years ago
@bzd2000 I will make the two optional methods in the next version
I think in the initstate should be changed to this (in order to make a copy of the tags in input).
@override void initState() { super.initState();
_tags = List<String>.from(widget.tags);
}
@bzd2000 but this way you would lose the reference from the outside
@Dn-a , In my opinion, this is better to avoid that a widget can impact its parent(s) behavior. I never use use by reference, because its difficult to track down where it has been changed.
I use application state (via redux) to manage shared data.
@bzd2000 yes you are right, but in other contexts it is easier and more convenient to have a single external temporary list (eg you could add a specific function to change the title of a tag etc ...)
@bzd2000 new version 0.4.2. check and leave feedback
I find the onInsert and onDelete implementation difficult to manage because it changes the input tags field and also triggers to inform the parent component on an insert or on a delete. This means you cannot set it with a contructor field from the parent (which should be final) For me the input tags fields should be immutable and then
onInsert returns the the added onDelete returns the deleted eventually onChange return the complete changed list of tags