consume_inapp_purchase 0.0.1 copy "consume_inapp_purchase: ^0.0.1" to clipboard
consume_inapp_purchase: ^0.0.1 copied to clipboard

Consume In-App Purchase is a Flutter plugin designed to streamline the handling of consumable in-app purchases for both Android and iOS platforms. It provides an intuitive API for consuming purchases [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:consume_inapp_purchase/consume_inapp_purchase.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _consumeInappPurchasePlugin = ConsumeInappPurchase();

  @override
  void initState() {
    super.initState();
  }

  Future<void> consumePurchase() async {
    String consumeStatus;
    try {
      consumeStatus = await _consumeInappPurchasePlugin.consumePurchase() ??
          'No purchase found.';
    } on PlatformException {
      consumeStatus = 'Failed to consume purchase.';
    }
    debugPrint(consumeStatus);
    if (!mounted) return;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: [
            ElevatedButton(
              onPressed: consumePurchase,
              child: const Text('Consume Purchase'),
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
140
points
12
downloads

Publisher

unverified uploader

Weekly Downloads

Consume In-App Purchase is a Flutter plugin designed to streamline the handling of consumable in-app purchases for both Android and iOS platforms. It provides an intuitive API for consuming purchases after they are successfully acknowledged, ensuring a seamless user experience for developers and end-users. Whether you're building a gaming app with consumable items or a productivity tool with incremental upgrades, this plugin simplifies the purchase lifecycle, saving you time and effort.

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on consume_inapp_purchase

Packages that implement consume_inapp_purchase