create static method

Gift create({
  1. bool schemeUtilsIsSetDefaultData = false,
  2. String special_type = "gift",
  3. String special_return_type = "gift",
  4. num? id,
  5. Sticker? sticker,
  6. num? star_count,
  7. num? default_sell_star_count,
  8. num? upgrade_star_count,
  9. bool? is_for_birthday,
  10. num? remaining_count,
  11. num? total_count,
  12. num? first_send_date,
  13. num? last_send_date,
})
override

Generate By AZKADEV | Azka Axelion Gibran Script Dont edit by hand or anything manual

Implementation

static Gift create({
  bool schemeUtilsIsSetDefaultData = false,
  String special_type = "gift",
  String special_return_type = "gift",
  num? id,
  Sticker? sticker,
  num? star_count,
  num? default_sell_star_count,
  num? upgrade_star_count,
  bool? is_for_birthday,
  num? remaining_count,
  num? total_count,
  num? first_send_date,
  num? last_send_date,
}) {
  // Gift gift = Gift({
  final Map gift_data_create_json = {
    "@type": special_type,
    "@return_type": special_return_type,
    "id": id,
    "sticker": (sticker != null) ? sticker.toJson() : null,
    "star_count": star_count,
    "default_sell_star_count": default_sell_star_count,
    "upgrade_star_count": upgrade_star_count,
    "is_for_birthday": is_for_birthday,
    "remaining_count": remaining_count,
    "total_count": total_count,
    "first_send_date": first_send_date,
    "last_send_date": last_send_date,
  };

  gift_data_create_json.removeWhere((key, value) => value == null);

  if (schemeUtilsIsSetDefaultData) {
    defaultData.forEach((key, value) {
      if (gift_data_create_json.containsKey(key) == false) {
        gift_data_create_json[key] = value;
      }
    });
  }
  return Gift(gift_data_create_json);
}