Don't use 'BuildContext's across async gaps.
sidcode

sidcode @sidcodeme

About: +_+!

Location:
Korea
Joined:
Aug 13, 2021

Don't use 'BuildContext's across async gaps.

Publish Date: Jul 20 '24
1 0

Don't use 'BuildContext's across async gaps.
Try rewriting the code to not use the 'BuildContext', or guard the use with a 'mounted' check.dartuse_build_context_synchronously

context.mounted
Enter fullscreen mode Exit fullscreen mode

Just wrap the error part with the following. We will process it after confirming the mount.

if (context. mounted) {

if (context.mounted) {
      if (isPrayedToday < 1) {
        _modalSalatFaithWrite.salatWrite(context, _controller);
      } else {
        _getShowModalAlreadyToday(context,
            S.of(context).modal_today_prayer_already);
      }
    }
Enter fullscreen mode Exit fullscreen mode

Comments 0 total

    Add comment