bdaTrackPurchase method

  1. @override
Future<bool> bdaTrackPurchase(
  1. int payAmount, {
  2. String contentType = 'recharge',
  3. String contentName = '会员',
  4. String orderId = '',
  5. String payType = '支付宝',
})
override

Implementation

@override
Future<bool> bdaTrackPurchase(
  int payAmount, {
  String contentType = 'recharge',
  String contentName = '会员',
  String orderId = '',
  String payType = '支付宝',
}) async {
  final Map<String, dynamic> args = <String, dynamic>{
    'payAmount': payAmount,
    'contentType': contentType,
    'contentName': contentName,
    'orderId': orderId,
    'payType': payType,
  };

  if (_isIOS) {
    final result = await generalMethodChannel.invokeMethod<bool>(
      'bda_trackPurchase',
      args,
    );
    return result ?? false;
  }

  // Android 现有实现未返回 result,保持 fire-and-forget 避免 Future 卡住。
  unawaited(generalMethodChannel.invokeMethod<void>('trackPurchase', args));
  return true;
}