Angelo Milella
 · Founder of dev Consulting

Generate a general Page Link

Hi, I would like to get your point of view with this situation I'm trying to deal with.

I would like to have the ability to generate links to the app pages without these being the current pages.

For example, if I integrate payments with Stripe Connect (via API) and I want to redirect after payment, how can I do it? Example: Payment success or error page.

Unfortunately this code doesn't work and I don't know what to do.

Thanks so much for the support..

// Automatic FlutterFlow imports
import '/backend/backend.dart';
import '/backend/schema/structs/index.dart';
import '/actions/actions.dart' as action_blocks;
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
import 'package:firebase_dynamic_links/firebase_dynamic_links.dart';

Future<String?> generateDynamicLink(String pageRoute) async {
  try {
    final parameters = DynamicLinkParameters(
      uriPrefix: 'https://aspr.page.link', // Sostituisci con il tuo uriPrefix
      link: Uri.parse(
          'https://equilab.flutterflow.io/$pageRoute'), // Sostituisci con la tua URL
      androidParameters: AndroidParameters(
        packageName:
            'com.equilab.aspr', // Sostituisci con il tuo packageName (Android)
      ),
      iosParameters: IosParameters(
        bundleId: 'com.equilab.aspr', // Sostituisci con il tuo bundleId (iOS)
      ),
    );

    final ShortDynamicLink shortLink =
        await FirebaseDynamicLinks.instance.buildShortLink(
      parameters,
      ShortDynamicLinkParameters(
        shortDynamicLinkPathLength: ShortDynamicLinkPathLength.unguessable,
      ),
    );
    return shortLink.shortUrl.toString();
  } catch (e) {
    print('Errore nella generazione del link dinamico: $e');
    return null;
  }
}

// Set your action name, define your arguments and return parameter,
// and then add the boilerplate code using the green button on the right!
2
10 replies