manageSubscription method

Future<void> manageSubscription()

Implementation

Future<void> manageSubscription() async {
  // Construct the URLs for Android and iOS.
  final androidUrl =
      Uri.parse('https://play.google.com/store/account/subscriptions');
  final iosUrl = Uri.parse('https://apps.apple.com/account/subscriptions');

  // Check the platform and choose the appropriate URL.
  final url = Platform.isAndroid ? androidUrl : iosUrl;

  // Check if the URL can be launched.
  if (await canLaunchUrl(url)) {
    // Launch the URL.
    await launchUrl(url);
  } else {
    // Log an error if the URL cannot be launched.
    if (kDebugMode) {
      print("Unable to launch subscription management page.");
    }
  }
}