btc_purchase 1.0.5 copy "btc_purchase: ^1.0.5" to clipboard
btc_purchase: ^1.0.5 copied to clipboard

A new InApp project.

example/lib/main.dart

import 'dart:convert';

import 'package:btc_purchase/btc_purchase.dart';
import 'package:btc_purchase/btc_purchase_widget.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() =>
      _MyAppState([ 'weekly_plan', 'monthly_plan', 'yearly_subscription'], BtcPurchase.SUBS, null, null);
}

class _MyAppState extends BtcPurchaseWidget<MyApp> {
  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      getAlreadyPurchase();
    });
  }

  getAlreadyPurchase() async {
    final list = await BtcPurchase.instance.getAlreadyPurchasedList([
      'weekly_plan', 'monthly_plan', 'yearly_subscription'
    ], BtcPurchase.SUBS, this);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: InkWell(
              onTap: () {
                launchPurchase('remove_ads', purchaseType: INAPP);
              },
              child: Text(
                  'Price: ${BtcPurchase.purchaseList}\n\n${jsonEncode(BtcPurchase.productsList)}')),
        ),
      ),
    );
  }

  _MyAppState(super.purchase_ids, super.purchase_type, super.purchase_other_ids,
      super.purchase_other_type);
}
1
likes
60
points
36
downloads

Publisher

unverified uploader

Weekly Downloads

A new InApp project.

Documentation

API reference

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on btc_purchase