setAppmateEvent static method

Future<BaseResponse> setAppmateEvent(
  1. String productId,
  2. UserEventType userEventType
)

setAppmateEvent method

Implementation

static Future<BaseResponse> setAppmateEvent(
    String productId, UserEventType userEventType) async {
  String? userEvent = null;
  if (userEventType == UserEventType.FIRST_LAUNCH) {
    userEvent = '1';
  } else if (userEventType == UserEventType.VIEW) {
    userEvent = '2';
  } else if (userEventType == UserEventType.PURCHASE) {
    userEvent = '3';
  }

  List<Object?>? response = await _channel.invokeMethod(
      'setAppmateEvent', {"productId": productId, 'userEvent': userEvent});
  BaseResponse result = new BaseResponse(false, null);
  if (response != null) {
    if (response[0] != null) {
      result = new BaseResponse(response[0].toString() == "true", null);
    }
    if (response[1] != null) {
      GenericError error =
          GenericError.fromJson(json.decode(response[1]!.toString()));
      result = new BaseResponse(false, error);
    }
    return result;
  }
  return result;
}