optionsParameters method

List<String> optionsParameters({
  1. bool? local,
  2. required String api_id,
  3. required String api_hash,
  4. String? http_port,
  5. String? http_stat_port,
  6. String? dir,
  7. String? temp_dir,
  8. String? filter,
  9. String? max_webhook_connections,
  10. String? http_ip_address,
  11. String? http_stat_ip_address,
  12. String? log,
  13. String? verbosity,
  14. String? memory_verbosity,
  15. String? log_max_file_size,
  16. String? username,
  17. String? groupname,
  18. String? max_connections,
  19. String? proxy,
})

make parameters easy

Implementation

List<String> optionsParameters({
  bool? local,
  required String api_id,
  required String api_hash,
  String? http_port,
  String? http_stat_port,
  String? dir,
  String? temp_dir,
  String? filter,
  String? max_webhook_connections,
  String? http_ip_address,
  String? http_stat_ip_address,
  String? log,
  String? verbosity,
  String? memory_verbosity,
  String? log_max_file_size,
  String? username,
  String? groupname,
  String? max_connections,
  String? proxy,
}) {
  Map data = {
    "--local": local,
    "--api-id": api_id,
    "--api-hash": api_hash,
    "--http-port": http_port,
    "--http-stat-port": http_stat_port,
    "--dir": dir,
    "--temp-dir": temp_dir,
    "--filter": filter,
    "--max-webhook-connections": max_webhook_connections,
    "--http-ip-address": http_ip_address,
    "--http-stat-ip-address": http_stat_ip_address,
    "--log": log,
    "--verbosity": verbosity,
    "--memory-verbosity": memory_verbosity,
    "--log-max-file-size": log_max_file_size,
    "--username": username,
    "--groupname": groupname,
    "--max-connections": max_connections,
    "--proxy": proxy,
  };
  List<String> arguments = ["test"];
  data.forEach((key, value) {
    if (key == "--local") {
      if (value == true) {
        arguments.add("$key");
      }
    } else if (value != null) {
      arguments.add("$key=$value");
    }
  });
  if (arguments.length > 2) {
    arguments.remove("test");
  }
  return arguments;
}