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

[bug]: Unhandled Exception: 'package:stacked_services/src/bottom_sheet/bottom_sheet_service.dart': Failed assertion: line 113 pos 7: '_sheetBuilders != null #1041

Open
felixjaehn opened this issue Oct 31, 2023 · 1 comment
Labels
Feedback Requested Waiting for new information from the OP

Comments

@felixjaehn
Copy link

Describe the bug

Although the project has been set up through the stacked CLI and the setCustomSheetBuilders function is called in main.dart this error still occurs when first using the showCustomSheet function.
After digging a little bit into it, it seems like the private variable _sheetBuilders gets set, when calling the setCustomSheetBuilders function but somehow is null again, when the showCustomSheet function is called.
I do not know why this happens.

To reproduce


void setupBottomSheetUi() {
  final bottomsheetService = locator<BottomSheetService>();

  final Map<BottomSheetType, SheetBuilder> builders = {
    BottomSheetType.notice: (context, request, completer) => NoticeSheet(request: request, completer: completer),
    BottomSheetType.postDetails: (context, request, completer) => PostDetailsSheet(request: request, completer: completer),
  };

  bottomsheetService.setCustomSheetBuilders(builders);
}
void showPostDetails() {
    _bottomSheetService.showCustomSheet(variant: BottomSheetType.notice);
  }

Expected behavior

No response

Screenshots

No response

Additional Context

No response

@FilledStacks
Copy link
Contributor

Hi, this works when I generate a project with Stacked.

   void showBottomSheet() {
     _bottomSheetService.showCustomSheet(
        variant: BottomSheetType.notice,
        title: ksHomeBottomSheetTitle,
        description: ksHomeBottomSheetDescription,
    );
  }

I see you're not passing in a title and description, make sure you're doing that and try again. Otherwise please generate a stacked project that reproduces this and share it with us so we can fix the bug.

@FilledStacks FilledStacks added the Feedback Requested Waiting for new information from the OP label Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feedback Requested Waiting for new information from the OP
Projects
None yet
Development

No branches or pull requests

2 participants