flutter_appodeal 0.1.0

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

flutter_appodeal

A Flutter plugin for iOS and Android to use Appodel SDK in your apps

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

You need to configure your apps first you use this plugin. Please refer to Appodeal documentation to get your apps configured. If you have any problems configuring your Flutter project, please take a look to Example project in the plugin code.

Import the library via

import 'package:flutter_appodeal/flutter_appodeal.dart';

Declare your listener to get notified about RewardedVideos callbacks

  FlutterAppodeal.instance.videoListener = (RewardedVideoAdEvent event, {String rewardType, int rewardAmount}) {
    print("RewardedVideoAd event $event");
    setState(() {
      videoState = "State $event";
    });
  };

Initialize the plugin with your App Keys

  List<AppodealAdType> types = new List<AppodealAdType>();
  types.add(AppodealAdType.AppodealAdTypeInterstitial);
  types.add(AppodealAdType.AppodealAdTypeRewardedVideo);

   // You should use here your APP Key from Appodeal
   await FlutterAppodeal.instance.initialize(Platform.isIOS ? 'IOSAPPKEY' : 'ANDROIDAPPKEY', types);

And the you can use it in your code

  void loadInterstital() async {
    bool loaded = await FlutterAppodeal.instance.isLoaded(AppodealAdType.AppodealAdTypeInterstitial);
    if (loaded) {
      FlutterAppodeal.instance.showInterstitial();
    }else{
      print("Interstitial not loaded");
    }
  }

Features

You can use, for now, Interstitials and Rewarded Videos. And there is a way to get notified for the RewardedVideos callbacks

[0.0.1] - Published May 11, 2018.

  • First Release: You can use, for now, Interstitials and Rewarded Videos. And there is a way to get notified for the RewardedVideos callbacks

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_appodeal/flutter_appodeal.dart';

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

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

class _MyAppState extends State<MyApp> {

  String videoState;

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

  // Platform messages are asynchronous, so we initialize in an async method.
  initPlatformState() async {
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      List<AppodealAdType> types = new List<AppodealAdType>();
      types.add(AppodealAdType.AppodealAdTypeInterstitial);
      types.add(AppodealAdType.AppodealAdTypeRewardedVideo);
      FlutterAppodeal.instance.videoListener =
          (RewardedVideoAdEvent event, {String rewardType, int rewardAmount}) {
        print("RewardedVideoAd event $event");
        setState(() {
          videoState = "State $event";
        });
      };
      // You should use here your APP Key from Appodeal
      await FlutterAppodeal.instance
          .initialize(Platform.isIOS ? 'IOSAPPKEY' : 'ANDROIDAPPKEY', types);
    } on PlatformException {}

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
        home: new Scaffold(
      appBar: new AppBar(
        title: new Text('$videoState'),
      ),
      body: new Padding(
        padding: new EdgeInsets.only(top: 40.0),
        child: new Center(
            child: new Column(children: <Widget>[
          new Container(
              height: 100.0,
              color: Colors.green,
              child: new FlatButton(
                onPressed: () {
                  this.loadRewarded();
                },
                child: new Text('Show Rewarded'),
              )),
          new Container(
              height: 100.0,
              color: Colors.blue,
              child: new FlatButton(
                onPressed: () {
                  this.loadInterstital();
                },
                child: new Text('Show Interstitial'),
              ))
        ])),
      ),
    ));
  }

  void loadInterstital() async {
    bool loaded = await FlutterAppodeal.instance
        .isLoaded(AppodealAdType.AppodealAdTypeInterstitial);
    if (loaded) {
      FlutterAppodeal.instance.showInterstitial();
    } else {
      print("No se ha cargado un Interstitial");
    }
  }

  void loadRewarded() async {
    bool loaded = await FlutterAppodeal.instance
        .isLoaded(AppodealAdType.AppodealAdTypeRewardedVideo);
    if (loaded) {
      FlutterAppodeal.instance.showRewardedVideo();
    } else {
      print("No se ha cargado un Rewarded Video");
    }
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_appodeal: "^0.1.0"

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_appodeal/flutter_appodeal.dart';
  
Version Uploaded Documentation Archive
0.1.0 May 11, 2018 Go to the documentation of flutter_appodeal 0.1.0 Download flutter_appodeal 0.1.0 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]
98 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
49
Learn more about scoring.

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • 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_appodeal.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.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