Flutter firebase unable to directly land in subpage

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


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.

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:firebase_dynamic_links/firebase_dynamic_links.dart';
import 'package:pirex/games/game/gameHome.dart';
import 'package:pirex/login/SocialPage.dart';

void main() {
  runApp(new MaterialApp(
    title: 'Game',
    routes: <String, WidgetBuilder>{
      '/': (BuildContext context) => new _MainScreen(),
      "/core": (BuildContext context) => GameHomePage(),
      '/NSef': (BuildContext context) => new SocialAppsPage("page_1"),
      '/82AY': (BuildContext context) => new SocialAppsPage("page_2"),
      '/DW7Y': (BuildContext context) => new SocialAppsPage("page_3"),

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

class _MainScreenState extends State<_MainScreen>  with WidgetsBindingObserver {
  Timer _timerLink;

  BuildContext get context => super.context;

  void initState() {

  void didChangeAppLifecycleState(AppLifecycleState state) {
    if (state == AppLifecycleState.resumed) {
      _timerLink = new Timer(const Duration(milliseconds: 850), () {

  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");

  void dispose() {
    if (_timerLink != null) {

  Widget build(BuildContext context) {
    return (new MaterialApp(
      title: 'Game',
      home: new GameHomePage(),


Any help or suggestions is appreciated. Thanks!