Flutter firebase unable to directly land in subpage









up vote
1
down vote

favorite












Hello Flutter/Firebase folks,



I am trying to implement a simple game that accepts firebase dynamic links and routes to the specific page of the app.



Use case:



A home page that has router which will route the page based on the dynamic link request to an app



Scenario:



User clicks on dynamic link from web browser of phone and the app opens given a user has an app and lands in the specific page.



What I am able to do?



I am able to open the specific page in the app. However, after user clicks on the dynamic link url, it first opens the home page of the app, and then gets redirected to the subpage. There is a delay of 1-2 second before landing to the specific page after first landing in the home page. What I would like - is to omit user landing in homepage and just land in the specific page of the dynamic link



**Code Format:**

Home Page : It has some Game


The router has 4 different subpages :

Default Home Page that will show game, and the rest other pages are based on the dynamic link provided Ex: Page_1, Page_2, and Page_3.

**What am I looking help or guidance?**

The suggestion I am looking is to avoid landing in home page (game landing page) when dynamic link is clicked from web url of the mobile.



void main()

runApp(new MaterialApp(
title: 'Game Name',
home: _MainScreen(),
routes: <String, WidgetBuilder>
'/NSef': (BuildContext context) => new SocialAppsPage(
"page-1-title",
"page-1"),
'/82AY': (BuildContext context) => new SocialAppsPage(
"page-2-title",
"page-2"),
'/DW7Y': (BuildContext context) => new SocialAppsPage(
"page-3-title",
"page-3"),
'/core': (BuildContext context) => new GameHomePage()
, ));


class _MainScreen extends StatefulWidget
@override
State<StatefulWidget> createState() => new _MainScreenState();


class _MainScreenState extends State<_MainScreen> with WidgetsBindingObserver

Timer _timerLink;


@override
BuildContext get context => super.context;

@override
void initState()
WidgetsBinding.instance.addObserver(this);
super.initState();


@override
void didChangeAppLifecycleState(AppLifecycleState state)
if (state == AppLifecycleState.resumed)
_timerLink = new Timer(const Duration(milliseconds: 1), ()
_retrieveDynamicLink();
);



Future<void> _retrieveDynamicLink() async
final PendingDynamicLinkData data =
await FirebaseDynamicLinks.instance.retrieveDynamicLink();
final Uri deepLink = data?.link;

if (deepLink != null)
Navigator.pushNamed(context, deepLink.path);
else
Navigator.pushNamed(context, "/core");



@override
void dispose()
WidgetsBinding.instance.removeObserver(this);
if (_timerLink != null)
_timerLink.cancel();

super.dispose();


@override
Widget build(BuildContext context)
return (new MaterialApp(
title: 'Game Name',
home: Center(
child: CircularProgressIndicator(),
),
navigatorObservers: <NavigatorObserver>[observer],
routes: <String, WidgetBuilder>
'/NSef': (BuildContext context) => new SocialAppsPage(
"page-1-title",
"Page-1"),
'/82AY': (BuildContext context) => new SocialAppsPage(
"page-2-title",
"Page-2"),
'/DW7Y': (BuildContext context) => new SocialAppsPage(
"page-3-title",
"page-3"),
'/core': (BuildContext context) => new GameHomePage()
,
));



Any help or suggestions is appreciated.
Thanks!









share|improve this question



























    up vote
    1
    down vote

    favorite












    Hello Flutter/Firebase folks,



    I am trying to implement a simple game that accepts firebase dynamic links and routes to the specific page of the app.



    Use case:



    A home page that has router which will route the page based on the dynamic link request to an app



    Scenario:



    User clicks on dynamic link from web browser of phone and the app opens given a user has an app and lands in the specific page.



    What I am able to do?



    I am able to open the specific page in the app. However, after user clicks on the dynamic link url, it first opens the home page of the app, and then gets redirected to the subpage. There is a delay of 1-2 second before landing to the specific page after first landing in the home page. What I would like - is to omit user landing in homepage and just land in the specific page of the dynamic link



    **Code Format:**

    Home Page : It has some Game


    The router has 4 different subpages :

    Default Home Page that will show game, and the rest other pages are based on the dynamic link provided Ex: Page_1, Page_2, and Page_3.

    **What am I looking help or guidance?**

    The suggestion I am looking is to avoid landing in home page (game landing page) when dynamic link is clicked from web url of the mobile.



    void main()

    runApp(new MaterialApp(
    title: 'Game Name',
    home: _MainScreen(),
    routes: <String, WidgetBuilder>
    '/NSef': (BuildContext context) => new SocialAppsPage(
    "page-1-title",
    "page-1"),
    '/82AY': (BuildContext context) => new SocialAppsPage(
    "page-2-title",
    "page-2"),
    '/DW7Y': (BuildContext context) => new SocialAppsPage(
    "page-3-title",
    "page-3"),
    '/core': (BuildContext context) => new GameHomePage()
    , ));


    class _MainScreen extends StatefulWidget
    @override
    State<StatefulWidget> createState() => new _MainScreenState();


    class _MainScreenState extends State<_MainScreen> with WidgetsBindingObserver

    Timer _timerLink;


    @override
    BuildContext get context => super.context;

    @override
    void initState()
    WidgetsBinding.instance.addObserver(this);
    super.initState();


    @override
    void didChangeAppLifecycleState(AppLifecycleState state)
    if (state == AppLifecycleState.resumed)
    _timerLink = new Timer(const Duration(milliseconds: 1), ()
    _retrieveDynamicLink();
    );



    Future<void> _retrieveDynamicLink() async
    final PendingDynamicLinkData data =
    await FirebaseDynamicLinks.instance.retrieveDynamicLink();
    final Uri deepLink = data?.link;

    if (deepLink != null)
    Navigator.pushNamed(context, deepLink.path);
    else
    Navigator.pushNamed(context, "/core");



    @override
    void dispose()
    WidgetsBinding.instance.removeObserver(this);
    if (_timerLink != null)
    _timerLink.cancel();

    super.dispose();


    @override
    Widget build(BuildContext context)
    return (new MaterialApp(
    title: 'Game Name',
    home: Center(
    child: CircularProgressIndicator(),
    ),
    navigatorObservers: <NavigatorObserver>[observer],
    routes: <String, WidgetBuilder>
    '/NSef': (BuildContext context) => new SocialAppsPage(
    "page-1-title",
    "Page-1"),
    '/82AY': (BuildContext context) => new SocialAppsPage(
    "page-2-title",
    "Page-2"),
    '/DW7Y': (BuildContext context) => new SocialAppsPage(
    "page-3-title",
    "page-3"),
    '/core': (BuildContext context) => new GameHomePage()
    ,
    ));



    Any help or suggestions is appreciated.
    Thanks!









    share|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Hello Flutter/Firebase folks,



      I am trying to implement a simple game that accepts firebase dynamic links and routes to the specific page of the app.



      Use case:



      A home page that has router which will route the page based on the dynamic link request to an app



      Scenario:



      User clicks on dynamic link from web browser of phone and the app opens given a user has an app and lands in the specific page.



      What I am able to do?



      I am able to open the specific page in the app. However, after user clicks on the dynamic link url, it first opens the home page of the app, and then gets redirected to the subpage. There is a delay of 1-2 second before landing to the specific page after first landing in the home page. What I would like - is to omit user landing in homepage and just land in the specific page of the dynamic link



      **Code Format:**

      Home Page : It has some Game


      The router has 4 different subpages :

      Default Home Page that will show game, and the rest other pages are based on the dynamic link provided Ex: Page_1, Page_2, and Page_3.

      **What am I looking help or guidance?**

      The suggestion I am looking is to avoid landing in home page (game landing page) when dynamic link is clicked from web url of the mobile.



      void main()

      runApp(new MaterialApp(
      title: 'Game Name',
      home: _MainScreen(),
      routes: <String, WidgetBuilder>
      '/NSef': (BuildContext context) => new SocialAppsPage(
      "page-1-title",
      "page-1"),
      '/82AY': (BuildContext context) => new SocialAppsPage(
      "page-2-title",
      "page-2"),
      '/DW7Y': (BuildContext context) => new SocialAppsPage(
      "page-3-title",
      "page-3"),
      '/core': (BuildContext context) => new GameHomePage()
      , ));


      class _MainScreen extends StatefulWidget
      @override
      State<StatefulWidget> createState() => new _MainScreenState();


      class _MainScreenState extends State<_MainScreen> with WidgetsBindingObserver

      Timer _timerLink;


      @override
      BuildContext get context => super.context;

      @override
      void initState()
      WidgetsBinding.instance.addObserver(this);
      super.initState();


      @override
      void didChangeAppLifecycleState(AppLifecycleState state)
      if (state == AppLifecycleState.resumed)
      _timerLink = new Timer(const Duration(milliseconds: 1), ()
      _retrieveDynamicLink();
      );



      Future<void> _retrieveDynamicLink() async
      final PendingDynamicLinkData data =
      await FirebaseDynamicLinks.instance.retrieveDynamicLink();
      final Uri deepLink = data?.link;

      if (deepLink != null)
      Navigator.pushNamed(context, deepLink.path);
      else
      Navigator.pushNamed(context, "/core");



      @override
      void dispose()
      WidgetsBinding.instance.removeObserver(this);
      if (_timerLink != null)
      _timerLink.cancel();

      super.dispose();


      @override
      Widget build(BuildContext context)
      return (new MaterialApp(
      title: 'Game Name',
      home: Center(
      child: CircularProgressIndicator(),
      ),
      navigatorObservers: <NavigatorObserver>[observer],
      routes: <String, WidgetBuilder>
      '/NSef': (BuildContext context) => new SocialAppsPage(
      "page-1-title",
      "Page-1"),
      '/82AY': (BuildContext context) => new SocialAppsPage(
      "page-2-title",
      "Page-2"),
      '/DW7Y': (BuildContext context) => new SocialAppsPage(
      "page-3-title",
      "page-3"),
      '/core': (BuildContext context) => new GameHomePage()
      ,
      ));



      Any help or suggestions is appreciated.
      Thanks!









      share|improve this question















      Hello Flutter/Firebase folks,



      I am trying to implement a simple game that accepts firebase dynamic links and routes to the specific page of the app.



      Use case:



      A home page that has router which will route the page based on the dynamic link request to an app



      Scenario:



      User clicks on dynamic link from web browser of phone and the app opens given a user has an app and lands in the specific page.



      What I am able to do?



      I am able to open the specific page in the app. However, after user clicks on the dynamic link url, it first opens the home page of the app, and then gets redirected to the subpage. There is a delay of 1-2 second before landing to the specific page after first landing in the home page. What I would like - is to omit user landing in homepage and just land in the specific page of the dynamic link



      **Code Format:**

      Home Page : It has some Game


      The router has 4 different subpages :

      Default Home Page that will show game, and the rest other pages are based on the dynamic link provided Ex: Page_1, Page_2, and Page_3.

      **What am I looking help or guidance?**

      The suggestion I am looking is to avoid landing in home page (game landing page) when dynamic link is clicked from web url of the mobile.



      void main()

      runApp(new MaterialApp(
      title: 'Game Name',
      home: _MainScreen(),
      routes: <String, WidgetBuilder>
      '/NSef': (BuildContext context) => new SocialAppsPage(
      "page-1-title",
      "page-1"),
      '/82AY': (BuildContext context) => new SocialAppsPage(
      "page-2-title",
      "page-2"),
      '/DW7Y': (BuildContext context) => new SocialAppsPage(
      "page-3-title",
      "page-3"),
      '/core': (BuildContext context) => new GameHomePage()
      , ));


      class _MainScreen extends StatefulWidget
      @override
      State<StatefulWidget> createState() => new _MainScreenState();


      class _MainScreenState extends State<_MainScreen> with WidgetsBindingObserver

      Timer _timerLink;


      @override
      BuildContext get context => super.context;

      @override
      void initState()
      WidgetsBinding.instance.addObserver(this);
      super.initState();


      @override
      void didChangeAppLifecycleState(AppLifecycleState state)
      if (state == AppLifecycleState.resumed)
      _timerLink = new Timer(const Duration(milliseconds: 1), ()
      _retrieveDynamicLink();
      );



      Future<void> _retrieveDynamicLink() async
      final PendingDynamicLinkData data =
      await FirebaseDynamicLinks.instance.retrieveDynamicLink();
      final Uri deepLink = data?.link;

      if (deepLink != null)
      Navigator.pushNamed(context, deepLink.path);
      else
      Navigator.pushNamed(context, "/core");



      @override
      void dispose()
      WidgetsBinding.instance.removeObserver(this);
      if (_timerLink != null)
      _timerLink.cancel();

      super.dispose();


      @override
      Widget build(BuildContext context)
      return (new MaterialApp(
      title: 'Game Name',
      home: Center(
      child: CircularProgressIndicator(),
      ),
      navigatorObservers: <NavigatorObserver>[observer],
      routes: <String, WidgetBuilder>
      '/NSef': (BuildContext context) => new SocialAppsPage(
      "page-1-title",
      "Page-1"),
      '/82AY': (BuildContext context) => new SocialAppsPage(
      "page-2-title",
      "Page-2"),
      '/DW7Y': (BuildContext context) => new SocialAppsPage(
      "page-3-title",
      "page-3"),
      '/core': (BuildContext context) => new GameHomePage()
      ,
      ));



      Any help or suggestions is appreciated.
      Thanks!






      android firebase dart flutter firebase-dynamic-links






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 at 18:55

























      asked Nov 8 at 0:12









      Bhupendra Acharya

      83




      83






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          What you can do is just display a loading screen on your first screen (could be similar to a splash screen maybe? ) .



           @override
          Widget build(BuildContext context)
          return (new MaterialApp(
          title: 'Game',
          home: Center(
          child: CircularProgressIndicator(),
          ),

          ));



          Code updated:



           void main() 

          runApp(new MaterialApp(
          title: 'Game Name',
          home: _MainScreen(),
          routes: <String, WidgetBuilder>
          '/NSef': (BuildContext context) => new SocialAppsPage(
          "page-1-title",
          "page-1"),
          '/82AY': (BuildContext context) => new SocialAppsPage(
          "page-2-title",
          "page-2"),
          '/DW7Y': (BuildContext context) => new SocialAppsPage(
          "page-3-title",
          "page-3"),
          '/core': (BuildContext context) => new GameHomePage()
          , ));


          class _MainScreen extends StatefulWidget
          @override
          State<StatefulWidget> createState() => new _MainScreenState();


          class _MainScreenState extends State<_MainScreen> with WidgetsBindingObserver

          Timer _timerLink;


          @override
          BuildContext get context => super.context;

          bool fromDynamicLink = false;

          verifyOrigin() async
          await Future.delayed(Duration(seconds: 1));
          if (!fromDynamicLink)
          fromDynamicLink = true;
          Navigator.pushNamed(context, "/core");



          @override
          void initState()
          WidgetsBinding.instance.addObserver(this);
          verifyOrigin();
          super.initState();


          @override
          void didChangeAppLifecycleState(AppLifecycleState state)
          if (state == AppLifecycleState.resumed)
          fromDynamicLink = true;
          _retrieveDynamicLink();



          Future<void> _retrieveDynamicLink() async
          final PendingDynamicLinkData data =
          await FirebaseDynamicLinks.instance.retrieveDynamicLink();
          final Uri deepLink = data?.link;

          if (deepLink != null)
          Navigator.pushNamed(context, deepLink.path);
          else
          Navigator.pushNamed(context, "/core");



          @override
          void dispose()
          WidgetsBinding.instance.removeObserver(this);
          if (_timerLink != null)
          _timerLink.cancel();

          super.dispose();


          @override
          Widget build(BuildContext context)
          return (new Scaffold(
          appBar: AppBar(title: Text('Game Name'),
          ),
          body: Center(
          child: CircularProgressIndicator(),
          ),
          ));







          share|improve this answer






















          • Comments are not for extended discussion; this conversation has been moved to chat.
            – Samuel Liew
            Nov 15 at 0:56










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53199789%2fflutter-firebase-unable-to-directly-land-in-subpage%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote



          accepted










          What you can do is just display a loading screen on your first screen (could be similar to a splash screen maybe? ) .



           @override
          Widget build(BuildContext context)
          return (new MaterialApp(
          title: 'Game',
          home: Center(
          child: CircularProgressIndicator(),
          ),

          ));



          Code updated:



           void main() 

          runApp(new MaterialApp(
          title: 'Game Name',
          home: _MainScreen(),
          routes: <String, WidgetBuilder>
          '/NSef': (BuildContext context) => new SocialAppsPage(
          "page-1-title",
          "page-1"),
          '/82AY': (BuildContext context) => new SocialAppsPage(
          "page-2-title",
          "page-2"),
          '/DW7Y': (BuildContext context) => new SocialAppsPage(
          "page-3-title",
          "page-3"),
          '/core': (BuildContext context) => new GameHomePage()
          , ));


          class _MainScreen extends StatefulWidget
          @override
          State<StatefulWidget> createState() => new _MainScreenState();


          class _MainScreenState extends State<_MainScreen> with WidgetsBindingObserver

          Timer _timerLink;


          @override
          BuildContext get context => super.context;

          bool fromDynamicLink = false;

          verifyOrigin() async
          await Future.delayed(Duration(seconds: 1));
          if (!fromDynamicLink)
          fromDynamicLink = true;
          Navigator.pushNamed(context, "/core");



          @override
          void initState()
          WidgetsBinding.instance.addObserver(this);
          verifyOrigin();
          super.initState();


          @override
          void didChangeAppLifecycleState(AppLifecycleState state)
          if (state == AppLifecycleState.resumed)
          fromDynamicLink = true;
          _retrieveDynamicLink();



          Future<void> _retrieveDynamicLink() async
          final PendingDynamicLinkData data =
          await FirebaseDynamicLinks.instance.retrieveDynamicLink();
          final Uri deepLink = data?.link;

          if (deepLink != null)
          Navigator.pushNamed(context, deepLink.path);
          else
          Navigator.pushNamed(context, "/core");



          @override
          void dispose()
          WidgetsBinding.instance.removeObserver(this);
          if (_timerLink != null)
          _timerLink.cancel();

          super.dispose();


          @override
          Widget build(BuildContext context)
          return (new Scaffold(
          appBar: AppBar(title: Text('Game Name'),
          ),
          body: Center(
          child: CircularProgressIndicator(),
          ),
          ));







          share|improve this answer






















          • Comments are not for extended discussion; this conversation has been moved to chat.
            – Samuel Liew
            Nov 15 at 0:56














          up vote
          0
          down vote



          accepted










          What you can do is just display a loading screen on your first screen (could be similar to a splash screen maybe? ) .



           @override
          Widget build(BuildContext context)
          return (new MaterialApp(
          title: 'Game',
          home: Center(
          child: CircularProgressIndicator(),
          ),

          ));



          Code updated:



           void main() 

          runApp(new MaterialApp(
          title: 'Game Name',
          home: _MainScreen(),
          routes: <String, WidgetBuilder>
          '/NSef': (BuildContext context) => new SocialAppsPage(
          "page-1-title",
          "page-1"),
          '/82AY': (BuildContext context) => new SocialAppsPage(
          "page-2-title",
          "page-2"),
          '/DW7Y': (BuildContext context) => new SocialAppsPage(
          "page-3-title",
          "page-3"),
          '/core': (BuildContext context) => new GameHomePage()
          , ));


          class _MainScreen extends StatefulWidget
          @override
          State<StatefulWidget> createState() => new _MainScreenState();


          class _MainScreenState extends State<_MainScreen> with WidgetsBindingObserver

          Timer _timerLink;


          @override
          BuildContext get context => super.context;

          bool fromDynamicLink = false;

          verifyOrigin() async
          await Future.delayed(Duration(seconds: 1));
          if (!fromDynamicLink)
          fromDynamicLink = true;
          Navigator.pushNamed(context, "/core");



          @override
          void initState()
          WidgetsBinding.instance.addObserver(this);
          verifyOrigin();
          super.initState();


          @override
          void didChangeAppLifecycleState(AppLifecycleState state)
          if (state == AppLifecycleState.resumed)
          fromDynamicLink = true;
          _retrieveDynamicLink();



          Future<void> _retrieveDynamicLink() async
          final PendingDynamicLinkData data =
          await FirebaseDynamicLinks.instance.retrieveDynamicLink();
          final Uri deepLink = data?.link;

          if (deepLink != null)
          Navigator.pushNamed(context, deepLink.path);
          else
          Navigator.pushNamed(context, "/core");



          @override
          void dispose()
          WidgetsBinding.instance.removeObserver(this);
          if (_timerLink != null)
          _timerLink.cancel();

          super.dispose();


          @override
          Widget build(BuildContext context)
          return (new Scaffold(
          appBar: AppBar(title: Text('Game Name'),
          ),
          body: Center(
          child: CircularProgressIndicator(),
          ),
          ));







          share|improve this answer






















          • Comments are not for extended discussion; this conversation has been moved to chat.
            – Samuel Liew
            Nov 15 at 0:56












          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted






          What you can do is just display a loading screen on your first screen (could be similar to a splash screen maybe? ) .



           @override
          Widget build(BuildContext context)
          return (new MaterialApp(
          title: 'Game',
          home: Center(
          child: CircularProgressIndicator(),
          ),

          ));



          Code updated:



           void main() 

          runApp(new MaterialApp(
          title: 'Game Name',
          home: _MainScreen(),
          routes: <String, WidgetBuilder>
          '/NSef': (BuildContext context) => new SocialAppsPage(
          "page-1-title",
          "page-1"),
          '/82AY': (BuildContext context) => new SocialAppsPage(
          "page-2-title",
          "page-2"),
          '/DW7Y': (BuildContext context) => new SocialAppsPage(
          "page-3-title",
          "page-3"),
          '/core': (BuildContext context) => new GameHomePage()
          , ));


          class _MainScreen extends StatefulWidget
          @override
          State<StatefulWidget> createState() => new _MainScreenState();


          class _MainScreenState extends State<_MainScreen> with WidgetsBindingObserver

          Timer _timerLink;


          @override
          BuildContext get context => super.context;

          bool fromDynamicLink = false;

          verifyOrigin() async
          await Future.delayed(Duration(seconds: 1));
          if (!fromDynamicLink)
          fromDynamicLink = true;
          Navigator.pushNamed(context, "/core");



          @override
          void initState()
          WidgetsBinding.instance.addObserver(this);
          verifyOrigin();
          super.initState();


          @override
          void didChangeAppLifecycleState(AppLifecycleState state)
          if (state == AppLifecycleState.resumed)
          fromDynamicLink = true;
          _retrieveDynamicLink();



          Future<void> _retrieveDynamicLink() async
          final PendingDynamicLinkData data =
          await FirebaseDynamicLinks.instance.retrieveDynamicLink();
          final Uri deepLink = data?.link;

          if (deepLink != null)
          Navigator.pushNamed(context, deepLink.path);
          else
          Navigator.pushNamed(context, "/core");



          @override
          void dispose()
          WidgetsBinding.instance.removeObserver(this);
          if (_timerLink != null)
          _timerLink.cancel();

          super.dispose();


          @override
          Widget build(BuildContext context)
          return (new Scaffold(
          appBar: AppBar(title: Text('Game Name'),
          ),
          body: Center(
          child: CircularProgressIndicator(),
          ),
          ));







          share|improve this answer














          What you can do is just display a loading screen on your first screen (could be similar to a splash screen maybe? ) .



           @override
          Widget build(BuildContext context)
          return (new MaterialApp(
          title: 'Game',
          home: Center(
          child: CircularProgressIndicator(),
          ),

          ));



          Code updated:



           void main() 

          runApp(new MaterialApp(
          title: 'Game Name',
          home: _MainScreen(),
          routes: <String, WidgetBuilder>
          '/NSef': (BuildContext context) => new SocialAppsPage(
          "page-1-title",
          "page-1"),
          '/82AY': (BuildContext context) => new SocialAppsPage(
          "page-2-title",
          "page-2"),
          '/DW7Y': (BuildContext context) => new SocialAppsPage(
          "page-3-title",
          "page-3"),
          '/core': (BuildContext context) => new GameHomePage()
          , ));


          class _MainScreen extends StatefulWidget
          @override
          State<StatefulWidget> createState() => new _MainScreenState();


          class _MainScreenState extends State<_MainScreen> with WidgetsBindingObserver

          Timer _timerLink;


          @override
          BuildContext get context => super.context;

          bool fromDynamicLink = false;

          verifyOrigin() async
          await Future.delayed(Duration(seconds: 1));
          if (!fromDynamicLink)
          fromDynamicLink = true;
          Navigator.pushNamed(context, "/core");



          @override
          void initState()
          WidgetsBinding.instance.addObserver(this);
          verifyOrigin();
          super.initState();


          @override
          void didChangeAppLifecycleState(AppLifecycleState state)
          if (state == AppLifecycleState.resumed)
          fromDynamicLink = true;
          _retrieveDynamicLink();



          Future<void> _retrieveDynamicLink() async
          final PendingDynamicLinkData data =
          await FirebaseDynamicLinks.instance.retrieveDynamicLink();
          final Uri deepLink = data?.link;

          if (deepLink != null)
          Navigator.pushNamed(context, deepLink.path);
          else
          Navigator.pushNamed(context, "/core");



          @override
          void dispose()
          WidgetsBinding.instance.removeObserver(this);
          if (_timerLink != null)
          _timerLink.cancel();

          super.dispose();


          @override
          Widget build(BuildContext context)
          return (new Scaffold(
          appBar: AppBar(title: Text('Game Name'),
          ),
          body: Center(
          child: CircularProgressIndicator(),
          ),
          ));








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 14 at 22:46

























          answered Nov 14 at 16:15









          diegoveloper

          7,99711223




          7,99711223











          • Comments are not for extended discussion; this conversation has been moved to chat.
            – Samuel Liew
            Nov 15 at 0:56
















          • Comments are not for extended discussion; this conversation has been moved to chat.
            – Samuel Liew
            Nov 15 at 0:56















          Comments are not for extended discussion; this conversation has been moved to chat.
          – Samuel Liew
          Nov 15 at 0:56




          Comments are not for extended discussion; this conversation has been moved to chat.
          – Samuel Liew
          Nov 15 at 0:56

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53199789%2fflutter-firebase-unable-to-directly-land-in-subpage%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo