pubstar_io 1.1.8%2B3

SDKflutter
Platformandroidios

PubStar Flutter AD SDK helps developers easily integrate ads into Flutter apps.

Pubstar

pub.dev

PubStar Flutter Mobile AD SDK is a comprehensive software development kit designed to empower developers with robust tools and functionalities for integrating advertisements seamlessly into Flutter mobile applications. Whether you're a seasoned developer or a newcomer to the world of app monetization, our SDK offers a user-friendly solution to maximize revenue streams while ensuring a non-intrusive and engaging user experience.

TOC

Features

  • ✅ Display native ads on Android & iOS with Pubstar API.
  • ✅ Full-featured API: load, show, loadAndShow, and handle ad events.
  • ✅ Easy-to-use Flutter widget: PubstarAdView and PubstarVideoAdView.
  • ✅ Structured ad event callback for type-safe event handling.

Platform Support

AndroidiOS
✔✔

Requirements

  • iOS >= 13.0
  • Min Dart SDK >= 3.7

Installation

Add the dependency in your pubspec.yaml file:

dependencies:
  pubstar_io

Then run:

flutter pub get

Configuration

iOS

1. Configure Pod.

  1. Navigate to your iOS project directory.

  2. Install the dependencies using pod install.

pod install
  1. Open your project in Xcode with the .xcworkspace file.

2. Update your Info.plist

Update your app's Info.plist file to add two keys:

A GADApplicationIdentifier key with a string value of your AdMob app ID found in the AdMob UI.

<key>GADApplicationIdentifier</key>
<string>Your AdMob app ID</string>
<key>NSUserTrackingUsageDescription</key>
<string>We use your data to show personalized ads and improve your experience.</string>
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Android

1. Configure Maven Repositories

Open your project-level build.gradle or settings.gradle and add:

repositories {
  mavenCentral()
  maven { url = uri("https://artifactory.appodeal.com/appodeal") }  <--- add this
}

2. Add Pubstar Key to AndroidManifest.

Open AndroidManifest.xml and add inside <application>:

<meta-data
  android:name="io.pubstar.key"
  android:value="pub-app-id-XXXX" />

Replace pub-app-id-XXXX with your actual Pubstar App ID.

Usage

Initialize the SDK

Initializes the Pubstar IO Ads SDK.

Must be called once before loading or showing any ad.

import 'package:pubstar_io/pubstar_io.dart';

void main() async {
  await PubstarIo.init();  <--- init Pubstar

  runApp(MyApp());
}

API

The example app in this repository shows an example usage of every single API, consult the example app if you have questions, and if you think you see a problem make sure you can reproduce it using the example app before reporting it, thank you.

MethodReturn Type
init()Future<void>
loadAd()Function<void>
showAd()Function<void>
loadAndShow()Function<void>
PubstarAdViewWidget
PubstarVideoAdViewWidget

init()

Initialization Pubstar SDK.

Pubstar.init();

loadAd()

Load Pubstar ads by adId to application.

Event

LoadListener

CallbackFunction
onErrorcall when load ad failed. return object type PubstarError
onLoadedcall when ad loaded

Example

PubstarIo.loadAd(
  adId,
  LoadListener(
    onLoaded: () => print("FLUTTER - app: onLoaded loadAd"),
    onError:
        (error) => print(
          "FLUTTER - app: onError loadAd, code: ${error.code} - rawCode: ${error.name}",
        ),
  ),
);

showAd()

Show ad had loaded before.

Event

LoadListener

CallbackFunction
onHidecall when ad hidden/closed (supports rewarded ads). Returns detailed PubstarReward object (type, amount).
onShowedcall when ad showed
onErrorcall when show ad failed. return object type PubstarError

Example

PubstarIo.showAd(
  adId,
  ShowListener(
    onShowed: () => print("FLUTTER - app: onShowed showAd"),
    onHide:
        (reward) => print(
          "FLUTTER - app: onHide showAd  - type: ${reward?.type ?? ""} - amount: ${reward?.amount ?? 0}",
        ),
    onError:
        (error) => print(
          "FLUTTER - app: onError showAd, code: ${error.code} - name: ${error.name} - message: ${error.message}",
        ),
  ),
);

loadAndShow()

Load and immediately show an ad by ID.

Event

LoadAndShowNoViewListener

CallbackFunction
onLoadedcall when ad loaded
onShowedcall when ad showed
onHidecall when ad hidden/closed (supports rewarded ads). Returns detailed PubstarReward object (type, amount).
onErrorcall when show ad failed. return object type PubstarError

Example

PubstarIo.loadAndShow(
  adId,
  LoadAndShowNoViewListener(
    onError:
        (error) => print(
          "FLUTTER - app: onError loadAndShow, code: ${error.code} - rawCode: ${error.name}",
        ),
    onHide:
        (reward) => print(
          "FLUTTER - app: onHide loadAndShow  - type: ${reward?.type ?? ""} - amount: ${reward?.amount ?? 0}",
        ),
    onLoaded: () => print("FLUTTER - app: onLoaded loadAndShow"),
    onShowed: () => print("FLUTTER - app: onShowed loadAndShow"),
  ),
);

PubstarAdView

Load ad then show ad, using for Banner ad and Native ad.

API

PropsFunction
adIdid of Banner or Native ad
sizesize of ad View. (small, medium, large)
typetype of ad View. (banner, native)
modemode of ad View (onlyShow, loadAndShow)
onErrorcall when show ad failed. return object type PubstarError
onHidecall when ad hidden/closed (supports rewarded ads). Returns detailed PubstarReward object (type, amount)
onLoadedcall when ad loaded
onShowedcall when ad showed

Example

PubstarAdView(
  adId: adId,
  size: PubstarAdSize.small,
  type: PubstarAdType.banner,
  mode: PubstarAdViewMode.loadAndShow,
  onError:
      (error) => print(
        "FLUTTER - app: onError banner, code: ${error.code} - rawCode: ${error.name}",
      ),
  onHide:
      (reward) => print(
        "FLUTTER - app: onHide banner  - type: ${reward?.type ?? ""} - amount: ${reward?.amount ?? 0}",
      ),
  onLoaded: () => print("FLUTTER - app: onLoaded banner"),
  onShowed: () => print("FLUTTER - app: onShowed banner"),
)

PubstarVideoAdView

Load video ad then show video ad, using for Video ad.

API

PropsFunction
adIdid of Video ad
mediaurl of media video
onErrorcall when show ad failed. return object type PubstarError
onHidecall when ad hidden/closed (supports rewarded ads). Returns detailed PubstarReward object (type, amount)
onLoadedcall when ad loaded
onShowedcall when ad showed

Example

PubstarVideoAdView(
  adId: adId,
  media:
      'https://storage.googleapis.com/gvabox/media/samples/stock.mp4',
  onError:
      (error) => print(
        "FLUTTER - app: onError video, code: ${error.code} - rawCode: ${error.name}",
      ),
  onHide:
      (reward) => print(
        "FLUTTER - app: onHide video  - type: ${reward?.type ?? ""} - amount: ${reward?.amount ?? 0}",
      ),
  onLoaded: () => print("FLUTTER - app: onLoaded video"),
  onShowed: () => print("FLUTTER - app: onShowed video"),
)

Release Notes

See the CHANGELOG.md.

ID Test AD

App ID : pub-app-id-1233
Banner Id : 1233/99228313580
Native ID : 1233/99228313581
Interstitial ID : 1233/99228313582
Open ID : 1233/99228313583
Rewarded ID : 1233/99228313584
Video ID : 1233/99228313585

Support

Email: developer@tqcsolution.com

Raise an issue on GitHub for bugs or feature requests.

License

Pubstar is released under the Apache License 2.0.

License agreement is available at LICENSE.