manage_iap_subscriptions 0.2.0 copy "manage_iap_subscriptions: ^0.2.0" to clipboard
manage_iap_subscriptions: ^0.2.0 copied to clipboard

Opens App Store or Google Play subscription management from Flutter on iOS and Android.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:manage_iap_subscriptions/manage_iap_subscriptions.dart';

void main() {
  runApp(const ManageIapSubscriptionsExample());
}

/// Demonstrates how to open either store's subscription management UI.
class ManageIapSubscriptionsExample extends StatelessWidget {
  /// Creates the plugin example application.
  const ManageIapSubscriptionsExample({super.key});

  Future<void> _showSubscriptionManagement(
    BuildContext context,
    Future<void> Function() showManagement,
  ) async {
    try {
      await showManagement();
    } on PlatformException catch (error) {
      if (!context.mounted) return;
      ScaffoldMessenger.of(context).showSnackBar(
        SnackBar(
          content: Text(
            error.message ?? 'Subscription management could not be opened.',
          ),
        ),
      );
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
      ),
      home: Builder(
        builder: (context) => Scaffold(
          appBar: AppBar(title: const Text('manage_iap_subscriptions')),
          body: Center(
            child: Padding(
              padding: const EdgeInsets.all(24),
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  const Text(
                    'Choose which store should manage the subscription.',
                    textAlign: TextAlign.center,
                  ),
                  const SizedBox(height: 24),
                  FilledButton(
                    onPressed: () => _showSubscriptionManagement(
                      context,
                      showAppStoreSubscriptionManagement,
                    ),
                    child: const Text('Manage App Store subscriptions'),
                  ),
                  const SizedBox(height: 12),
                  FilledButton(
                    onPressed: () => _showSubscriptionManagement(
                      context,
                      showGooglePlaySubscriptionManagement,
                    ),
                    child: const Text('Manage Google Play subscriptions'),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
1
likes
160
points
139
downloads

Documentation

API reference

Publisher

verified publisherdieringe.com

Weekly Downloads

Opens App Store or Google Play subscription management from Flutter on iOS and Android.

Repository (GitHub)
View/report issues

Topics

#in-app-purchases #subscriptions #storekit #google-play

License

MIT (license)

Dependencies

flutter

More

Packages that depend on manage_iap_subscriptions

Packages that implement manage_iap_subscriptions