piano_common 1.0.0
piano_common: ^1.0.0 copied to clipboard
Common package for Piano Flutter SDK.
Piano SDK for Flutter #
Packages #
- piano_common — Core SDK entry point and shared infrastructure
- piano_id — User authentication via Piano ID
piano_common #
Core package that provides the main entry point and shared infrastructure for the Piano Flutter SDK.
Installation
Add the dependency to your pubspec.yaml:
dependencies:
piano_common: ^1.0.0
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.example.com',
composer: 'https://c2.example.com',
id: 'https://id.example.com',
);
// Single-URL endpoint (all services on the same host)
final local = PianoEndpoint.fromUrl('http://localhost:8080');
Consent Configuration
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(),
);
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(),
);