trackRevenue method
Tracks a revenue-generating event.
This is a convenience method that wraps trackEvent with specialized
revenue properties (revenue and currency).
Parameters:
amount: The decimal value of the transaction.currency: The 3-letter ISO code (e.g., "USD").properties: Optional additional context.
Implementation
@override
Future<void> trackRevenue({
required double amount,
required String currency,
Map<String, dynamic>? properties,
}) async {
if (amount < 0) {
throw InvalidEventDataError('Revenue amount must be non-negative');
}
final eventProperties = Map<String, dynamic>.from(properties ?? {});
eventProperties['revenue'] = amount;
eventProperties['currency'] = currency;
await trackEvent('revenue', eventProperties);
}