Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flutter_form_builder v3 error #51

Closed
pcccccc opened this issue Apr 20, 2019 · 6 comments
Closed

flutter_form_builder v3 error #51

pcccccc opened this issue Apr 20, 2019 · 6 comments

Comments

@pcccccc
Copy link

pcccccc commented Apr 20, 2019

I use the value of FormBuilderDropdown to add or remove rows when

flutter: Field with attribute 'attribute' already exists. Make sure that two or more fields don't have the
flutter: same attribute name.
flutter: 'package:flutter_form_builder/src/form_builder.dart': Failed assertion: line 64 pos 12:
flutter: '_fieldKeys.containsKey(attribute) == false'

How can I configure to add or delete rows?

`_formList.add(
FormBuilderDropdown(
attribute: "test",
decoration: InputDecoration(labelText: "test"),
items: _accountTypeOptionsList,
initialValue: _accountTypeOptionsList[0].value,
validators: [],
onChanged: (value) {

        _fbKey.currentState.reset();

        if (value == 0) {

          _formList.add(
            FormBuilderTextField(
              attribute: 'attribute',
              decoration: InputDecoration(
                labelText: 'test',
                hintText: 'test',
                enabledBorder: UnderlineInputBorder(
                  borderSide: BorderSide(width: 0.2),
                ),
                focusedBorder: UnderlineInputBorder(
                  borderSide: BorderSide(width: 0.2, color: Common.themeColor()),
                ),
              ),
              validators: [],
            ),
          );
        }else {
          _formList.removeLast();
        }
        setState(() {

        });
        print(value);
      },
    )
);`
@pcccccc
Copy link
Author

pcccccc commented Apr 20, 2019

`_formList.add(
FormBuilderDropdown(
attribute: "test",
decoration: InputDecoration(labelText: "test"),
items: _accountTypeOptionsList,
initialValue: _accountTypeOptionsList[0].value,
validators: [],
onChanged: (value) {

        _fbKey.currentState.reset();

        if (value == 0) {

          _formList.add(
            FormBuilderTextField(
              attribute: 'attribute',
              decoration: InputDecoration(
                labelText: 'test',
                hintText: 'test',
                enabledBorder: UnderlineInputBorder(
                  borderSide: BorderSide(width: 0.2),
                ),
                focusedBorder: UnderlineInputBorder(
                  borderSide: BorderSide(width: 0.2, color: Common.themeColor()),
                ),
              ),
              validators: [],
            ),
          );
        }else {
          _formList.removeLast();
        }
        setState(() {

        });
        print(value);
      },
    )
);`

@danvick
Copy link
Collaborator

danvick commented Apr 20, 2019

Hi @pcccccc,
Kindly include more code so that I can have working code to reproduce the error.

@pcccccc
Copy link
Author

pcccccc commented Apr 20, 2019

@danvick
main.dart.zip
pubspec.yaml : flutter_form_builder: ^3.0.0-beta.9

@danvick
Copy link
Collaborator

danvick commented Apr 20, 2019

I've gone through the bug and it has unraveled a fundamental issue in the package. Consequently I've published version 3.0.0-beta.10 which addresses the issue.
Kindly update and let me know if the problem has been sorted.
It's working well on my side after the update.

Thanks for bringing this up as it has helped us stabilize the package further as the release of v3 is nearing.

@pcccccc
Copy link
Author

pcccccc commented Apr 21, 2019

use 3.0.0-beta.10
@danvick thx

@shrutikateiosys
Copy link

hi @danvick i am also facing same issue.
i had made use of flutter form builder updated package for building dynamic form. all working good. even if i remove last item from list in remove properly using removeAt(index) but when i try to remove middle index it throw error attribute id already exist. what goes wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants