unity_ads_flutter 1.1.0

  • README.md
  • Example
  • Installing
  • Versions
  • 75


Unity Ads for Flutter. This is an unofficial plugin based on the official Unity Ads plugins for Android and iOS.

Getting Started

This plugin wraps the native Android and iOS APIs of Unity Ads. To learn more about the usage see the official Untiy Ads API Documentation for Android. Read CHANGELOG.md to see which versions of the native plugins are included.

[1.1.0] - 04.09.2018

Currently the following versions of the Unity Ads native plugins are used:

  • Android: 2.3.0
  • iOS: Nils told me that on iOS the newest version is used automatically

[1.0.0] - 11.05.2018

Currently the following versions of the Unity Ads native plugins are used:

  • Android: 2.2.1
  • iOS: 2.2.0


import 'package:flutter/material.dart';
import 'package:unity_ads_flutter/unity_ads_flutter.dart';

//TODO use your own ids from the Unity Ads Dashboard
const String videoPlacementId='video';
const String gameIdAndroid='1790451';
const String gameIdIOS='1790452';

void main() async {
  runApp(new MyApp());

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

class _MyAppState extends State<MyApp> with UnityAdsListener{

  UnityAdsError _error;
  String _errorMessage;
  bool _ready;

  initState() {
    UnityAdsFlutter.initialize(gameIdAndroid, gameIdIOS, this, true);
    _ready = false;

  Widget build(BuildContext context) {
    Widget body;
        body = new Center(
            child: new Text('$_error: $_errorMessage')
      } else if(_ready){
        body=new Center(
            child:new RaisedButton(
                onPressed: () {
                child: const Text('Ready')
      } else {
        body = new Center(
            child:const Text('Waiting for an ad...')
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Unity Ads Flutter Example'),
        body: body,

  void onUnityAdsError(UnityAdsError error, String message) {
    print('$error occurred: $message');

  void onUnityAdsFinish(String placementId, FinishState result) {
    print('Finished $placementId with $result');

  void onUnityAdsReady(String placementId) {
    print('Ready: $placementId');
    if (placementId == videoPlacementId){
      setState(() {

  void onUnityAdsStart(String placementId) {
    print('Start: $placementId');
    if(placementId == videoPlacementId){
      setState(() {
        _ready = false;

Use this package as a library

1. Depend on it

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

  unity_ads_flutter: ^1.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:unity_ads_flutter/unity_ads_flutter.dart';
Version Uploaded Documentation Archive
1.1.0 Sep 4, 2018 Go to the documentation of unity_ads_flutter 1.1.0 Download unity_ads_flutter 1.1.0 archive
1.0.0 May 11, 2018 Go to the documentation of unity_ads_flutter 1.0.0 Download unity_ads_flutter 1.0.0 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.6
  • Flutter: 0.11.3


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

The description is too short. (-20 points)

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


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.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8