title: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 5338 pos 12: '!_debugLocked': is not true. And this is my Code given Below
body: <p>When i implement code for Splash screen page and that navigate to a login screen and rising an EXception Like this 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 5338 pos 12: '!_debugLocked': is not true. the function i declared for navigating the page is not working properly but there is no compile time error, the error is only showing while run time. I don't Know how to this Solve this Pls Anybody help</p>
  <pre><code>import 'package:first_project_1/Screens/login.dart';
  import 'package:flutter/cupertino.dart';
  import 'package:flutter/material.dart';
  
  class ScreenSplash extends StatefulWidget {
    const ScreenSplash({Key? key}) : super(key: key);
  
    @override
    _ScreenSplashState createState() =&gt; _ScreenSplashState();
  }
  
  class _ScreenSplashState extends State&lt;ScreenSplash&gt; {
  
    @override
    void initState() {
      // TODO: implement initState
      super.initState();
      gotoLogin(context);
    }
    @override
    void didChangeDependencies() {
      // TODO: implement didChangeDependencies
      super.didChangeDependencies();
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Center(
          child: Image.asset('assets/images/VDlogo.png',height: 150,),
        ),
      );
    }
    @override
    void dispose() {
      // TODO: implement dispose
      super.dispose();
    }
    Future&lt;void&gt; gotoLogin(BuildContext context) async {
      Future.delayed(Duration(seconds: 4),);
      Navigator.of(context).pushReplacement(
        MaterialPageRoute(
          builder: (ctx)=&gt; ScreenLogin(),
        ),
      );
    }
  }
  </code></pre>