asCurl method
return string of curl command, you can test it in console
Implementation
String asCurl({String? file_path}) {
var cmd_base = 'curl ';
if (this.headers.isNotEmpty) {
this.headers.forEach((k, v) {
cmd_base = "${cmd_base} -H \"${k}:${v}\"";
});
}
if (this.method == 'PUT') {
cmd_base = "${cmd_base} -T";
}
if (this.method == 'POST') {
cmd_base = "${cmd_base} -X POST";
}
if (this.method == 'DELETE') {
cmd_base = "${cmd_base} -X DELETE";
}
if (this._fileData != null) {
cmd_base = "${cmd_base} \"${file_path}\"";
}
cmd_base = '${cmd_base} ${this.Url}';
return cmd_base;
}