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

setState() called after dispose() #88

Open
mrizkynurfajrie opened this issue Apr 26, 2024 · 0 comments
Open

setState() called after dispose() #88

mrizkynurfajrie opened this issue Apr 26, 2024 · 0 comments

Comments

@mrizkynurfajrie
Copy link

Hi there,
i'm facing a error message "Another exception was thrown: setState() called after dispose(): _MultiSelectDropDownState#5f37b(lifecycle state: defunct, not mounted)" after open the page.

error dispose

Here how i reproduce using this package.

MultiSelectDropDown Widget

            Expanded(
                child: MultiSelectDropDown<Object>(
                  padding: EdgeInsets.symmetric(horizontal: 4.w),
                  controller: brandMultiController,
                  hint: "Select Brand",
                  hintStyle: TextStyles.textStdBlack.copyWith(
                    color: AppColor.neutral.shade400,
                    fontSize: FontSizes.s12,
                  ),
                  fieldBorderRadius: Corners.lg,
                  fieldBackgroundColor: AppColor.neutral.shade200,
                  borderColor: brandOutlineColor,
                  boxHeight: 46.h,
                  dropdownHeight: 225.h,
                  selectionType: SelectionType.single,
                  singleSelectItemStyle: TextStyles.textStdBlack,
                  clearIcon: null,
                  searchEnabled: true,
                  searchLabel: "search",
                  searchBackgroundColor: AppColor.whiteColor,
                  searchHintStyle: TextStyles.textStdBlack.copyWith(
                    fontSize: FontSizes.s12,
                    color: AppColor.neutral.shade400,
                  ),
                  searchContentPadding: EdgeInsets.symmetric(
                    horizontal: 12.w,
                    vertical: 2.h,
                  ),
                  optionTextStyle: TextStyles.textStdBlack,
                  optionSeparator: Container(
                    height: 1,
                    width: Get.width,
                    color: AppColor.neutral.shade300,
                  ),
                  options: brandOption,
                  onOptionSelected: onBrandOptionSelected,
                ),
              ),

Declare MultiSelectDropDown Controller

var brandMultiController = List<MultiSelectController<Object>>.empty(growable: true);

I do insert MultiSelectController into a growable List because it could be multiple MultiSelectDropDown widget with the same type/options.

Set Option

                                                    brandOption: controller
                                                        .listSelectedBrand
                                                        .map((item) {
                                                      return ValueItem(
                                                        label: item.brandName!,
                                                        value: item.brandId,
                                                      );
                                                    }).toList(),

And I have a required condition after an option selected

                                                    onBrandOptionSelected:
                                                        (brand) {
                                                      controller
                                                          .categoryMultiController[
                                                              index]
                                                          .setOptions(
                                                        controller
                                                            .listSelectedCategory
                                                            .map((item) {
                                                          return ValueItem(
                                                            label: item
                                                                .description!,
                                                            value: item.id,
                                                          );
                                                        }).toList(),
                                                      );
                                                    },

But after the code run, just like this error doesn't impact anything to how this widget works, everything's going very well.
Is it just a bug, or maybe something happen but i don't aware about that?

For now i'm using the latest version of this package.

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

1 participant