30 lines
1.1 KiB
Dart
30 lines
1.1 KiB
Dart
import 'billing_models.dart';
|
|
|
|
/// Clean abstraction over store billing operations.
|
|
/// All platform-specific types (e.g. in_app_purchase / BillingClient) remain isolated behind this interface.
|
|
abstract class BillingService {
|
|
/// Stream emitting real-time purchase updates from the store.
|
|
Stream<List<StorePurchase>> get purchaseStream;
|
|
|
|
/// Initializes the billing service and verifies connection to the store.
|
|
Future<bool> initialize();
|
|
|
|
/// Whether the store service (e.g. Google Play Billing) is currently available on the device.
|
|
Future<bool> isAvailable();
|
|
|
|
/// Queries the store for product details matching the catalog.
|
|
Future<List<StoreProduct>> queryProducts();
|
|
|
|
/// Initiates purchase flow for a product.
|
|
Future<bool> launchPurchaseFlow(String productId);
|
|
|
|
/// Restores prior purchases from the store (e.g. on reinstall or new device).
|
|
Future<void> restorePurchases();
|
|
|
|
/// Acknowledges / completes an eligible purchase transaction with the store.
|
|
Future<void> completePurchase(StorePurchase purchase);
|
|
|
|
/// Disposes listeners and resources.
|
|
void dispose();
|
|
}
|