onUrlChange method

FutureOr<NavigationDecision> onUrlChange(
  1. dynamic request,
  2. dynamic callback(
    1. Map<String, dynamic>,
    2. BuildContext
    )?,
  3. dynamic context
)

Implementation

FutureOr<NavigationDecision> onUrlChange (request,
    Function(Map<String, dynamic>, BuildContext)? callback, context)
async {
  if (request.url.startsWith(KKiaPayRedirectURL)) {
    //print('blocking navigation to $request}');

    hideWebView ();
    loadingStart ();

    /**
     * Payment Done with success
     */
    final link = Uri.parse(request.url);
    final transactionId = link.queryParameters['transaction_id'];
    callback!( { 'requestData': data, 'transactionId': transactionId, 'status': 'SUCCESS' }, context);

    /**
     * dispose this view switch  [disposeOnCallBack]
     */
    //try{ Navigator.pop(context); } catch(e) {Utils.log.e(e);}

    return NavigationDecision.prevent;
  }
  if (request.url.startsWith(WaveRedirectURI)
      || request.url.startsWith(WaveStoreRedirectURI)) {
    Utils.launchWave(request.url);
    return NavigationDecision.prevent;
  }

  return NavigationDecision.navigate;
}