flutter_in_app 0.0.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new50

flutter_billing

A plugin for Flutter that enables communication with billing API in iOS and Android.

This plugin implements in app purchases rather than Android Pay or Apple Pay. Both Apple and Google collect fees upon each successful transaction made using this plugin.

Warning: This plugin is still under development, some billing features are not available yet and testing has been limited. Feedback and Pull Requests are welcome.

Using

Add flutter_billing flutter_billing as a dependency in pubspec.yaml.

Create an instance of the plugin:

final Billing billing = new Billing(onError: (e) {
  // optionally handle exception
});

Request available products for purchase:

final List<BillingProduct> products = await billing.getProducts(<String>[
    'my.product.id',
    'my.other.product.id',
]);

or

final BillingProduct product = await billing.getProduct('my.product.id');
if (product != null) {
  // success
} else {
  // something went wrong
}

Request purchased products (each purchase is a product identifier):

final Set<String> purchases = await billing.getPurchases();

Check if a product is already purchased:

final bool purchased = purchases.contains('my.product.id');

or

final bool purchases = await billing.isPurchased('my.product.id');

Purchase a product:

final bool purchased = await billing.purchase(productId);

Limitations

This is just an initial version of the plugin. There are still some limitations:

  • Only non-consumable in app products are supported

0.2.2

  • Fix on iOS to return price in cents ($1.99 = 199)

0.2.1

  • Report Exception instead of Error as per type in Dart 2

0.2.0

  • Breaking change. Dart 2 support

0.1.3

  • On iOS product price was passed as double to Dart code

0.1.2

  • Skip a product if information is not fulfilled properly

0.1.1

  • iOS Support. Library is tested on iOS. Feature parity for both iOS and Android.

0.1.0

  • New breaking API to address caching of products and purchases.

0.0.2

  • Basic documented API

0.0.1

  • Initial Release

example/lib/main.dart

import 'package:flutter/material.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        ),
        body: new Center(
          child: new Text('Billing.'),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_in_app: "^0.0.3"

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


      import 'package:flutter_in_app/flutter_in_app.dart';
  
Version Uploaded Documentation Archive
0.0.3 May 11, 2018 Go to the documentation of flutter_in_app 0.0.3 Download flutter_in_app 0.0.3 archive
0.0.2 May 11, 2018 Go to the documentation of flutter_in_app 0.0.2 Download flutter_in_app 0.0.2 archive
0.0.1 May 11, 2018 Go to the documentation of flutter_in_app 0.0.1 Download flutter_in_app 0.0.1 archive

Analysis

We analyzed this package on May 22, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.54.0
  • pana: 0.11.1
  • Flutter: 0.4.4

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
99 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
50
Learn more about scoring.

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 hint.

    Run flutter format to format lib/flutter_in_app.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
synchronized ^1.1.0 1.4.0
Transitive dependencies
collection 1.14.6 1.14.9
meta 1.1.5
sky_engine 0.0.99
typed_data 1.1.5
vector_math 2.0.6 2.0.7