create static method

Session create({
  1. bool schemeUtilsIsSetDefaultData = false,
  2. String special_type = "session",
  3. String special_return_type = "session",
  4. num? id,
  5. bool? is_current,
  6. bool? is_password_pending,
  7. bool? is_unconfirmed,
  8. bool? can_accept_secret_chats,
  9. bool? can_accept_calls,
  10. SessionType? type,
  11. num? api_id,
  12. String? application_name,
  13. String? application_version,
  14. bool? is_official_application,
  15. String? device_model,
  16. String? platform,
  17. String? system_version,
  18. num? log_in_date,
  19. num? last_active_date,
  20. String? ip_address,
  21. String? location,
})
override

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

Implementation

static Session create({
  bool schemeUtilsIsSetDefaultData = false,
  String special_type = "session",
  String special_return_type = "session",
  num? id,
  bool? is_current,
  bool? is_password_pending,
  bool? is_unconfirmed,
  bool? can_accept_secret_chats,
  bool? can_accept_calls,
  SessionType? type,
  num? api_id,
  String? application_name,
  String? application_version,
  bool? is_official_application,
  String? device_model,
  String? platform,
  String? system_version,
  num? log_in_date,
  num? last_active_date,
  String? ip_address,
  String? location,
}) {
  // Session session = Session({
  final Map session_data_create_json = {
    "@type": special_type,
    "@return_type": special_return_type,
    "id": id,
    "is_current": is_current,
    "is_password_pending": is_password_pending,
    "is_unconfirmed": is_unconfirmed,
    "can_accept_secret_chats": can_accept_secret_chats,
    "can_accept_calls": can_accept_calls,
    "type": (type != null) ? type.toJson() : null,
    "api_id": api_id,
    "application_name": application_name,
    "application_version": application_version,
    "is_official_application": is_official_application,
    "device_model": device_model,
    "platform": platform,
    "system_version": system_version,
    "log_in_date": log_in_date,
    "last_active_date": last_active_date,
    "ip_address": ip_address,
    "location": location,
  };

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

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