Skip to content

setState inside _onSaved returns error #29

@fral8

Description

@fral8

Dear All,
I've noticed an issue when I call setState inside _onSaved function.
Basically, I need to set the selected values in my state.

  onSaved: (value) {
    setState(() => this.selectedData = value);
  }

This line causes the error:
The following NoSuchMethodError was thrown building MultiSelect(dirty, dependencies: [_FormScope], state: FormFieldState<dynamic>#140cb): The method '[]' was called on null. Receiver: null Tried calling: []("display")

It's well known that forms are reloaded on setState function (see here), but how to solve this issue for the library?

Sincerely,
Francesco

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions