Curl class

A representation of a cURL command in Dart.

The Curl class provides methods for parsing a cURL command string and formatting a Curl object back into a cURL command.

Constructors

Curl({required Uri uri, String method = 'GET', Map<String, String>? headers, String? data, String? cookie, String? user, String? referer, String? userAgent, List<FormDataModel>? formData, bool form = false, bool insecure = false, bool location = false})
Constructs a new Curl object with the specified parameters.

Properties

Sends cookies with the request.
final
data → String?
Sends data as the request body (typically used with POST requests).
final
form → bool
Sends data as a multipart/form-data request.
final
formData → List<FormDataModel>?
Form data list.
final
hashCode → int
The hash code for this object.
no setterinherited
headers → Map<String, String>?
Adds custom HTTP headers to the request.
final
insecure → bool
Allows insecure SSL connections.
final
location → bool
Follows HTTP redirects.
final
method → String
Specifies the HTTP request method (e.g., GET, POST, PUT, DELETE).
final
props → List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
referer → String?
Sets the Referer header for the request.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stringify → bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
uri → Uri
Specifies the HTTP request URL.
final
user → String?
Specifies the username and password for HTTP basic authentication.
final
userAgent → String?
Sets the User-Agent header for the request.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toCurlString() → String
Converts the Curl object to a formatted cURL command string.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

parse(String curlString) → Curl
Parse curlString as a Curl class instance.
tryParse(String curlString) → Curl?
Parses curlString into a Curl class instance.