title: Error thrown on navigator pop until : "!_debugLocked': is not true."
body: <p>When popping a screen navigating to other one by clicking on the showBottomSheet, this error is thrown through the following code . I cant get why this is occurring.</p>
  <pre class="lang-dart prettyprint-override"><code>class _CheckoutButtonState extends State&lt;_CheckoutButton&gt; {
    final GlobalKey&lt;ScaffoldState&gt; _globalKey = GlobalKey();
    final DateTime deliveryTime = DateTime.now().add(Duration(minutes: 30));
  
    final double deliveryPrice = 5.00;
  
    @override
    Widget build(BuildContext context) {
      SubscriptionService subscriptionService =
          Provider.of&lt;SubscriptionService&gt;(context);
      CheckoutService checkoutService = Provider.of&lt;CheckoutService&gt;(context);
      return Container(
        height: 48.0,
        width: MediaQuery.of(context).size.width * 0.75,
        child: StreamBuilder(
          stream: subscriptionService.subscription$,
          builder: (_, AsyncSnapshot&lt;Subscription&gt; snapshot) {
            if (!snapshot.hasData) {
              return Text(&quot;CHECKOUT&quot;);
            }
            final Subscription subscription = snapshot.data;
            final List&lt;Order&gt; orders = subscription.orders;
            final Package package = subscription.package;
            num discount = _getDiscount(package);
            num price = _totalPriceOf(orders, discount);
            return StreamBuilder&lt;bool&gt;(
                stream: checkoutService.loading$,
                initialData: false,
                builder: (context, snapshot) {
                  bool loading = snapshot.data;
                  return ExtendedFloatingActionButton(
                    loading: loading,
                    disabled: loading,
                    action: () async {
                      checkoutService.setLoadingStatus(true);
                      final subscription =
                          await Provider.of&lt;SubscriptionService&gt;(context)
                              .subscription$
                              .first;
                      try {
                        await CloudFunctions.instance.call(
                            functionName: 'createSubscription',
                            parameters: subscription.toJSON);
                        final bottomSheet =
                            _globalKey.currentState.showBottomSheet(
                          (context) {
                            return Container(
                              width: MediaQuery.of(context).size.width,
                              decoration: BoxDecoration(
                                gradient: LinearGradient(
                                  begin: Alignment.topCenter,
                                  end: Alignment.bottomCenter,
                                  colors: [
                                    Theme.of(context).scaffoldBackgroundColor,
                                    Theme.of(context).primaryColor,
                                    Theme.of(context).primaryColor,
                                  ],
                                  stops: [-1.0, 0.5, 1.0],
                                ),
                              ),
                              child: Column(
                                children: &lt;Widget&gt;[
                                  Expanded(
                                    child: Column(
                                      mainAxisAlignment: MainAxisAlignment.center,
                                      children: &lt;Widget&gt;[
                                        Padding(
                                          padding:
                                              const EdgeInsets.only(bottom: 16.0),
                                          child: Text(
                                            &quot;Thank you for your order&quot;,
                                            textAlign: TextAlign.center,
                                            style: Theme.of(context)
                                                .textTheme
                                                .display1,
                                          ),
                                        ),
                                        SvgPicture.asset(
                                          'assets/images/thumb.svg',
                                          height: 120.0,
                                          width: 100.0,
                                        )
                                        // CircleAvatar(
                                        // radius: 40.0,
                                        // backgroundColor: Colors.transparent,
                                        // child: Icon(
                                        // Icons.check,
                                        // color: Theme.of(context)
                                        // .textTheme
                                        // .display1
                                        // .color,
                                        // size: 80.0,
                                        // ),
                                        // ),
                                      ],
                                    ),
                                  ),
                                  Container(
                                    width:
                                        MediaQuery.of(context).size.width * 0.9,
                                    height: 72.0,
                                    padding: EdgeInsets.only(bottom: 24),
                                    child: ExtendedFloatingActionButton(
                                      text: &quot;ORDER DETAILS&quot;,
                                      action: () {
                                        Navigator.of(context).pop();
                                      },
                                    ),
                                  ),
                                ],
                              ),
                            );
                          },
                        );
                        bottomSheet.closed.then((v) {
                          Navigator.of(context)
                              .popUntil((r) =&gt; r.settings.isInitialRoute);
                        });
                      } catch (e) {
                        print(e);
                        final snackBar =
                            SnackBar(content: Text('Something went wrong!'));
                        Scaffold.of(context).showSnackBar(snackBar);
                      }
                    },
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: &lt;Widget&gt;[
                        Text(
                          &quot;CHECKOUT &quot;,
                          style: Theme.of(context)
                              .textTheme
                              .display4
                              .copyWith(color: Colors.white),
                        ),
                        Text(
                          &quot;EGP &quot; +
                              (price + (orders.length * deliveryPrice))
                                  .toStringAsFixed(2),
                          style: Theme.of(context)
                              .textTheme
                              .display4
                              .copyWith(color: Theme.of(context).primaryColor),
                        ),
                      ],
                    ),
                  );
                });
          },
        ),
      );
    }
  
    num _totalPriceOf(List&lt;Order&gt; orders, num discount) {
      num price = 0;
      orders.forEach((Order order) {
        List&lt;Product&gt; products = order.products;
        products.forEach((Product product) {
          price = price + product.price;
        });
      });
      num priceAfterDiscount = price * (1 - (discount / 100));
      return priceAfterDiscount;
    }
  
    num _getDiscount(Package package) {
      if (package == null) {
        return 0;
      } else {
        return package.discount;
      }
    }
  }
  
  </code></pre>
  <h3>Error :</h3>
  <pre><code>&gt;══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
  I/flutter (24830): The following assertion was thrown building Navigator-[GlobalObjectKey&lt;NavigatorState&gt;
  I/flutter (24830): _WidgetsAppState#90d1f](dirty, state: NavigatorState#6b2b6(tickers: tracking 1 ticker)):
  I/flutter (24830): 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 1995 pos 12: '!_debugLocked':
  I/flutter (24830): is not true.
  I/flutter (24830): Either the assertion indicates an error in the framework itself, or we should provide substantially
  I/flutter (24830): more information in this error message to help you determine and fix the underlying cause.
  I/flutter (24830): In either case, please report this assertion by filing a bug on GitHub:
  I/flutter (24830):   https://github.com/flutter/flutter/issues/new?template=BUG.md
  I/flutter (24830): When the exception was thrown, this was the stack:
  </code></pre>