dartins 0.2.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 63

Dartins

Cordova/PhoneGap plugin definitions for use in Dart projects.

Generally speaking, any interactions with plugins should happen after the "deviceReady" event has fired. See example for a simple implementation.

Supported plugins

  • Device (these are all properties)
    • cordova
    • model
    • platform
    • uuid
    • version
    • manufacturer
    • isVirtual
    • serial
  • Splashscreen
    • show();
    • hide();
  • AdMob Pro - Note! This plugin takes 2% of your revenue if you don't buy a license. For this reason, I'm deprecating support for it
    • Please see the next section on a replacement
  • AdMob - forked from AppFeel
    • Forked to remove 2% revenue stealing
    • Will be kept up to date as necessary
    • To install, simply run: cordova plugin add https://github.com/kkleokrish/admob-google-cordova-clean --save
  • In-app Purchase
    • ProductEvent when(String v);
    • refresh();
    • order(String v);
    • ready(Function v);
    • register(StoreProduct product);
  • Google Analytics
    • startTrackerWithId(String v);
    • trackView(String v);
    • trackEvent(String category, String action, [String label, num v]);
    • trackException(String description, bool fatal);
    • trackTiming(String category, num intervalInMilliseconds, String v, String label);
    • addTransaction(String id, String affiliation, num revenue, num tax, num shipping, String currencyCode);
    • addTransactionItem(String id, String name, String sku, String category, num price, num quantity, String currencyCode);
    • addCustomDimension(String key, String value, [Function success, Function error]);
    • setUserId(String id);
    • debugMode();
    • enableUncaughtExceptionReporting(bool enable, [Function success, Function error]);
  • In-app Browser
    • InappBrowser open(String url, String target, [String options]);
    • addEventListener(String eventname, Function cb);
    • removeEventListener(String eventname, Function cb);
    • close();
    • show();
    • executeScript(InjectDetails details, Function cb);
    • insertCSS(InjectDetails details, Function cb);
  • Amazon Mobile Ads
    • See additional notes below
    • All ad methods are supported.
    • Events are supported
  • Statusbar
    • All methods and properties supported
  • Facebook
    • All methods supported
    • Facebook's official plugin has been abandoned, this plugin is an active, up-to-date fork.
    • To support every option, please use at least version 1.7.2
  • App Settings
    • Fully supported
    • AppSettingsHelper class to provide ease-of-use
  • Network Information
    • Fully supported
    • Connection types are available on ConnectionTypes
    • Event names are constants in the connection class
  • Microsoft CodePush
    • Basic functionality supported
  • iOS AVAudioSession
    • Fully supported

Amazon Ads Specific Notes

Amazon doesn't make it easy to integrate Cordova with their ad platform but here's some notes.

With this package, there is an "AmazonAds" class that has a developer-friendly interface to the plugin. You should see if that meets your needs before going directly to the methods in "amazon_mobile_ads.dart".

To install the plugin, you'll have to download it from Amazon and install it manually. It's not in npm (so you can't do cordova plugin add <>)

Installation

Edit your pubspec.yaml file:

dependencies:
  dartins: ^0.1.1

Then run pub get

Dependencies

The only dependencies outside of Dart are the plugins themselves. You only need to install the plugins you wish to use.

For example, if you want to use the Admob and Device plugins, but no others, simply run:

cordova plugin add https://github.com/kkleokrish/admob-google-cordova-clean.git --save
cordova plugin add cordova-plugin-device --save

Compilation

To build for Cordova/PhoneGap, the steps are as follows:

  1. Run pub build
  2. Copy the contents of the build folder into the www folder in your Cordova project
  3. Run cordova run android (substitute the Cordova command for what your desired setup).

If you're using PhoneGap Build, you don't need any extra setup to be able to use this package. Just do steps 1 and 2 and then submit your build (make sure you set up the plugins correctly!).

Usage

A simple usage example:

import 'dart:html';
import 'package:dartins/dartins.dart';

main() {
    document.on['deviceready'].listen((_){

        //Device Example
        var currentPlatform = Device.platform;
        print('Currently using a ${currentPlatform} device');

        //Splashscreen Example
        Splashscreen.hide();

        //AdMob example
        AdMob.createBanner(new BannerOptions(
            adId: 'cx-xxx',
            position: AdMobPosition.BOTTOM_CENTER.index,
            isTesting: Device.UUID == '123123',
            overlap: true
        ));

        //Store example
        Store.register(new StoreProduct(id: 'product1', type: StoreProduct.NON_CONSUMABLE));
        Store.when('product1').approved(allowInterop((var product){
            print('Successfully bought product1');
            product.finish();
        }));
        Store.when('product1').owned(allowInterop((var product){
            print('Owns product1');
        }));

        //Analytics example
        GoogleAnalytics.startTrackerWithId('xxx-xxx');
        GoogleAnalytics.trackView('mainMenu');
        GoogleAnalytics.trackEvent('AppState', 'started');

        //In-app browser example
        InappBrowser iab = InappBrowser.open('http://google.com', InappBrowser.TARGET_BLANK);
        iab.show();
        iab.close();
    });
}

Changelog

0.2.0

  • Updated to Dart 2.0

0.1.5

0.1.4

  • Switch AVAudioSession plugin to use a new fork
  • Bug fixes for CodePush

0.1.3+2

  • Fixed the actual bug I was seeing with getCurrentPackage and getPendingPackage.

0.1.3+1

  • Fixed bug with checkForUpdate and notifyApplicationReady. Apparently CodePush will call the callbacks multiple times.

0.1.3

  • Added support for the CodePush plugin

0.1.2

  • Added support for the Network Information plugin

0.1.1

  • Added support for App Settings plugin

0.1.0

  • BREAKING CHANGE: The AdMob Pro plugin forces a 2% donation, as a result, I'm deprecating the API. It's now called "AdMobPro". Please see the file for additional changes.
  • NEW: Added support for my forked version of another AdMob plugin. See the Readme for details on the plugin.
  • Includes more "Dart like" library. See src/admob.dart for details.

0.0.8+4

  • Added "quote" field for Share dialog. Requires version 1.7.2 of the plugin.

0.0.8+3

  • Added missing share options for Facebook iOS

0.0.8+2

  • Facebook SDK on iOS returns a different structure than Android

0.0.8+1

  • Added Facebook library that hides plugin API.
  • Moved Amazon helper library to same file to make things simpler.

0.0.8

  • Added support for the Facebook plugin

0.0.7

  • Added support for the Statusbar plugin

0.0.6+1

  • Return types for non-void methods. Unwraps all "booleanValue" results to straight booleans.

0.0.6

  • Added event support for Amazon Ads

0.0.5

  • Added missing Device properties

0.0.4

  • Added partial support for Amazon Ads plugin (no support for events yet)

0.0.3

  • Add support for the In-app Browser plugin

0.0.2

  • Added support for Google Analytics and Splashscreen plugins.
  • Updated documentation with more examples

0.0.1

  • Initial version
  • Support for AdMob, Device and Store

Use this package as a library

1. Depend on it

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


dependencies:
  dartins: ^0.2.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:dartins/dartins.dart';
  
Version Uploaded Documentation Archive
0.2.0 Oct 7, 2018 Go to the documentation of dartins 0.2.0 Download dartins 0.2.0 archive
0.1.5 Jun 15, 2018 Go to the documentation of dartins 0.1.5 Download dartins 0.1.5 archive
0.1.4 Jun 8, 2017 Go to the documentation of dartins 0.1.4 Download dartins 0.1.4 archive
0.1.3+2 Jun 7, 2017 Go to the documentation of dartins 0.1.3+2 Download dartins 0.1.3+2 archive
0.1.3+1 Jun 7, 2017 Go to the documentation of dartins 0.1.3+1 Download dartins 0.1.3+1 archive
0.1.3 Jun 7, 2017 Go to the documentation of dartins 0.1.3 Download dartins 0.1.3 archive
0.1.2 Oct 7, 2016 Go to the documentation of dartins 0.1.2 Download dartins 0.1.2 archive
0.1.1 Aug 30, 2016 Go to the documentation of dartins 0.1.1 Download dartins 0.1.1 archive
0.1.0 Aug 4, 2016 Go to the documentation of dartins 0.1.0 Download dartins 0.1.0 archive
0.0.8+3 Jul 30, 2016 Go to the documentation of dartins 0.0.8+3 Download dartins 0.0.8+3 archive

All 21 versions...

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

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

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: web, other

Primary library: package:dartins/dartins.dart with components: js.

Health suggestions

Format lib/src/admob.dart.

Run dartfmt to format lib/src/admob.dart.

Format lib/src/admob_pro.dart.

Run dartfmt to format lib/src/admob_pro.dart.

Format lib/src/amazon_mobile_ads.dart.

Run dartfmt to format lib/src/amazon_mobile_ads.dart.

Fix additional 11 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/app_settings.dart (Run dartfmt to format lib/src/app_settings.dart.)
  • lib/src/av_audio_session.dart (Run dartfmt to format lib/src/av_audio_session.dart.)
  • lib/src/code_push.dart (Run dartfmt to format lib/src/code_push.dart.)
  • lib/src/device.dart (Run dartfmt to format lib/src/device.dart.)
  • lib/src/facebook.dart (Run dartfmt to format lib/src/facebook.dart.)
  • lib/src/google_analytics.dart (Run dartfmt to format lib/src/google_analytics.dart.)
  • lib/src/inapp_browser.dart (Run dartfmt to format lib/src/inapp_browser.dart.)
  • lib/src/network_information.dart (Run dartfmt to format lib/src/network_information.dart.)
  • lib/src/splashscreen.dart (Run dartfmt to format lib/src/splashscreen.dart.)
  • lib/src/statusbar.dart (Run dartfmt to format lib/src/statusbar.dart.)
  • lib/src/store.dart (Run dartfmt to format lib/src/store.dart.)

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use dartins.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <3.0.0
js >=0.6.0 <0.7.0 0.6.1+1
Dev dependencies
test >=0.12.0