Skip to content

onSaved method is not working #30

@WilliBobadilla

Description

@WilliBobadilla

when I try to save data, onSaved is not working, I put some prints inside to verify, and is nos executing the function. So I edit the libreary locally and added one link in the onTap listener of the InkWell in the flutter_multiselect.dart, as follow:

 return InkWell(
                  onTap: () async {
                    var results = await Navigator.push(
                        state.context,
                        MaterialPageRoute<dynamic>(
                          builder: (BuildContext context) => SelectionModal(
                              filterable: filterable,
                              valueField: valueField,
                              textField: textField,
                              dataSource: dataSource,
                              values: state.value ?? []),
                          fullscreenDialog: true,
                        ));

                    if (results != null) {
                      if (results.length > 0) {
                        state.didChange(results);
                      } else {
                        state.didChange(null);
                      }
                      print('selected value $results');
                      onSaved(
                          results); //added to listen the chaneges on the onSaved method
                    }
                  },

and it works for me! 👍

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