trackCharge method Null safety

void trackCharge(
  1. double amount,
  2. {Map<String, dynamic>? properties}

Track a revenue transaction for the identified people profile.

  • amount the amount of money exchanged. Positive amounts represent purchases or income from the customer, negative amounts represent refunds or payments to the customer.
  • properties an optional collection of properties to associate with this transaction.


void trackCharge(double amount, {Map<String, dynamic>? properties}) {
  // ignore: unnecessary_null_comparison
  if (amount != null) {
    _channel.invokeMethod<void>('trackCharge', <String, dynamic>{
      'token': this._token,
      'amount': amount,
      'properties': properties
  } else {
    developer.log('`people trackCharge` failed: amount cannot be blank',
        name: 'Mixpanel');