【问题标题】:Error: _AssertionError ('package:flutter/src/widgets/navigator.dart': Failed assertion: line 4893 pos 12: '!_debugLocked': is not true.)错误:_AssertionError (\'package:flutter/src/widgets/navigator.dart\': Failed assertion: line 4893 pos 12: \'!_debugLocked\': is not true.)
【发布时间】:2023-02-05 21:00:10
【问题描述】:

我是 Flutter 的新手。我遇到了关于_AssertionError ('package:flutter/src/widgets/navigator.dart': Failed assertion: line 4893 pos 12: '!_debugLocked': is not true.) 的问题。很长一段时间以来,我一直在寻找解决此问题的方法,但仍然找不到解决方案。

如果有任何用户帮助,我将不胜感激。

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    只需将此添加到您的代码中:

    Future.delayed(Duration.zero, () {
      Navigator.pop(context);
    });
    

    【讨论】:

      【解决方案2】:

      试试下面的代码:

      Future.delayed(const Duration(milliseconds: 10), () {
        Navigator.of(context, rootNavigator: true).pop();
      });
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-01-16
        • 2020-01-21
        • 2022-06-27
        • 2022-01-14
        • 2021-11-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多