initPlatformStateForStringUniLinks method

Future<void> initPlatformStateForStringUniLinks()

Implementation

Future<void> initPlatformStateForStringUniLinks() async {
  logCat('IN initPlatformState For String UniLinks');
  // Attach a listener to the links stream
  // _streamSubscription = linkStream.listen((String? link) {
  //   //if (!mounted) return;
  //   //setState(() {});
  //   latestLink = link ?? 'Unknown';
  //   _latestUri = null;
  //   try {
  //     if (link != null) _latestUri = Uri.parse(link);
  //   } on FormatException {
  //     logCat('FormatException... ');
  //   }
  // }, onError: (Object err) {
  //   //if (!mounted) return;
  //   //setState(() { });
  //   latestLink = 'Failed to get latest link: $err.';
  //   _latestUri = null;
  // });
  // Get the latest link
  // Platform messages may fail, so we use a try/catch PlatformException.
  try {
    // _initialLink = await getInitialLink();
    // logCat('initial link: $_initialLink');
    // if (_initialLink != null) {
    //   _initialUri = Uri.parse(_initialLink!);
    // }
  } on PlatformException {
    _initialLink = 'Failed to get initial link.';
    _initialUri = null;
  } on FormatException {
    _initialLink = 'Failed to parse the initial link as Uri.';
    _initialUri = null;
  }

  // If the widget was removed from the tree while the asynchronous platform
  // message was in flight, we want to discard the reply rather than calling
  // setState to update our non-existent appearance.
  //if (!mounted) return;

  latestLink = TypeSafeConversion.nullSafeString(_initialLink,
      defaultValue: 'Unknown');
  _latestUri = _initialUri;
  getNavigatorPushNamed();
}