iaphub_flutter 1.0.2 copy "iaphub_flutter: ^1.0.2" to clipboard
iaphub_flutter: ^1.0.2 copied to clipboard

outdated

The easiest way to implement IAP (In-app purchase) in your Flutter app

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'stores/index.dart';
import 'pages/login.dart';
import 'pages/store.dart';

void main() => runApp(const MyApp());

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'IAPHUB Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const HomePage()
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          Observer(
            builder: (_) => appStore.isLogged ? const StorePage() : const LoginPage()
          ),
          Observer(
            builder: (_) {
              if (appStore.alert != null) {
                return AlertDialog(
                  title: const Text("Alert"),
                  content: Text(appStore.alert ?? ""),
                  actions: <Widget>[
                    TextButton(
                      child: const Text("OK"),
                      onPressed: () {
                        appStore.closeAlert();
                      },
                    ),
                  ],
                );
              }
              else {
                return Container();
              }
            }
          )
        ]
      )
    );
  }
}
14
likes
0
points
145
downloads

Publisher

verified publisheriaphub.com

Weekly Downloads

The easiest way to implement IAP (In-app purchase) in your Flutter app

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

flutter

More

Packages that depend on iaphub_flutter

Packages that implement iaphub_flutter