tryParse static method

Curl? tryParse(
  1. String curlString
)

Parses curlString into a Curl class instance.

Like parse except that this function returns null where a similar call to parse would throw a throwable.

Example:

print(Curl.tryParse('curl -X GET https://www.example.com/')); // Curl(method: 'GET', url: 'https://www.example.com/')
print(Curl.tryParse('1f')); // null

Implementation

static Curl? tryParse(String curlString) {
  try {
    return Curl.parse(curlString);
  } catch (_) {
    return null;
  }
}