crosspromote 0.2.0 copy "crosspromote: ^0.2.0" to clipboard
crosspromote: ^0.2.0 copied to clipboard

Framework-agnostic, minimal dependencies, and pure Dart package for implementing CrossPromote in your project.

CrossPromote - Dart #

CrossPromote package compatible with Dart.

Caution

This package contains base Dart implementation only. Prefer using crosspromote_flutter for Flutter apps and crosspromote_jaspr for Jaspr websites.

Package Publisher MIT License

crosspromote is a pure Dart package that connects to the CrossPromote API.

Other implementations include:

Getting started #

  1. Create an account on CrossPromote and top it up.

  2. Create your first ad, assign it to a an ad set, and create a new app.

  3. Copy your app's identifier (it's visible under your app's name in the dashboard).

  4. Add this package to your dependencies.

dependencies:
  crosspromote: latest_version
  1. Get the dependencies.
dart pub get
  1. Use the CrossPromoteClient to retrieve ads:
// Create a new client.
final client = new CrossPromoteClient(
  // Replace with your app's identifier from CrossPromote.
  appId: 'example.image',
);

// Fetch an ad.
final ad = await client.retrieve(
  size: AdSize.w300h250,
  match: AdMatch.preferredSize,
);

// One of the following: `image`, `metadata`, `empty`.
print(ad.type);

// An URL that redirects to a page specified in the console.
// This URL is a special variant that also tracks the number of clicks.
print(ad.targetUrl);

// Custom JSON payload specified in the console.
print(ad.payload);

// Properties available only for ads with type `image`.
if (ad.type == AdType.image) {
  print(ad.imageUrl);
  print(ad.size);
}

Additional information #

  • You can use predefined identifiers to test your app during development, and avoid incurring cost during testing. Use example.image as your app id to display a placeholder image, or example.metadata for metadata ad.
  • This package requires Dart 3.8 or newer to work.
  • If there are any issues feel free to go to GitHub Issues and report a bug.

Maintainers #

0
likes
150
points
109
downloads

Publisher

verified publishernikodembernat.com

Weekly Downloads

Framework-agnostic, minimal dependencies, and pure Dart package for implementing CrossPromote in your project.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

equatable, http, logging, meta

More

Packages that depend on crosspromote