piano_common 1.0.3 copy "piano_common: ^1.0.3" to clipboard
piano_common: ^1.0.3 copied to clipboard

Common package for Piano Flutter SDK.

Piano SDK for Flutter #

Installation #

Add the dependency to your pubspec.yaml:

dependencies:
  piano_common: ^1.0.3

Getting Started #

Initialize the SDK with your Application ID (AID) and an endpoint:

import 'package:piano_common/piano_common.dart';

final piano = await Piano.init(
  endpoint: PianoEndpoint.production,
  aid: '<AID>',
);

Endpoints #

Use one of the predefined regional endpoints or define a custom one:

// Predefined endpoints
PianoEndpoint.production          // Global
PianoEndpoint.productionEurope    // EU
PianoEndpoint.productionAustralia // Australia
PianoEndpoint.productionAsiaPacific // Asia-Pacific
PianoEndpoint.sandbox             // Sandbox

// Custom endpoint
final custom = PianoEndpoint(
  api: 'https://api.piano.io',
  composer: 'https://c2.piano.io',
  id: 'https://id.piano.io',
);

// Single-URL endpoint (all services on the same host)
final local = PianoEndpoint.fromUrl('http://localhost:8080');

See piano_consents_flutter.

Optionally pass a PianoConsentConfiguration to control consent behavior:

import 'package:piano_consents_flutter/piano_consents_flutter.dart';

final piano = await Piano.init(
  endpoint: PianoEndpoint.production,
  aid: '<AID>',
  consentConfig: PianoConsentConfiguration(),
);

Localization #

Pass a language code to localize Piano content. It defaults to en_US:

final piano = await Piano.init(
  endpoint: PianoEndpoint.production,
  aid: '<AID>',
  language: 'fr_FR',
);

The value is available to all Piano services through piano.client.language.

Logging #

Enable debug logging by providing a Logger instance:

import 'package:logger/logger.dart';

final piano = await Piano.init(
  endpoint: PianoEndpoint.sandbox,
  aid: '<AID>',
  logger: Logger(),
);
0
likes
130
points
168
downloads

Documentation

API reference

Publisher

verified publisherpiano.io

Weekly Downloads

Common package for Piano Flutter SDK.

Homepage

License

Apache-2.0 (license)

Dependencies

flutter, http, logger, piano_consents_flutter, shared_preferences, uuid

More

Packages that depend on piano_common