Skip to content

Commit

Permalink
Remove seemingly redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
Glitchy-Tozier committed Apr 21, 2022
1 parent 8aa3ccd commit 38088d7
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions lib/widgets/form_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ class _FormListState extends State<FormList> {
(_) => '',
);

late List<String> values;

@override
void initState() {
super.initState();
Expand All @@ -60,8 +58,8 @@ class _FormListState extends State<FormList> {

/// Initialize the List of default-values.
void _initList() {
// The values that will be placed inside [formFields]
final List<String> initialValues = List<String>.from(widget.initialValues);

// Make sure the list isn't empty
if (initialValues.isEmpty) {
initialValues.add('');
Expand All @@ -78,9 +76,6 @@ class _FormListState extends State<FormList> {
textFormField(widget.fieldName, i, initialValues[i]),
);
}

// Save current initValues to make sure change is detected.
values = widget.initialValues;
}

Widget textFormField(
Expand Down Expand Up @@ -188,10 +183,6 @@ class _FormListState extends State<FormList> {

@override
Widget build(BuildContext context) {
if (values != widget.initialValues) {
_initList();
}

return Column(
children: <Widget>[
...formFields,
Expand Down

0 comments on commit 38088d7

Please sign in to comment.