toJson method

Map<String, dynamic> toJson()

Produces a Map that can be serialized to JSON.

Implementation

Map<String, dynamic> toJson() {
  return <String, dynamic>{
    if (url != null) 'url': url,
    if (method != null) 'method': method,
    if (queryString != null) 'query_string': queryString,
    if (_data != null) 'data': _data,
    if (cookies != null) 'cookies': cookies,
    if (headers.isNotEmpty) 'headers': headers,
    if (env.isNotEmpty) 'env': env,
    // ignore: deprecated_member_use_from_same_package
    if (other.isNotEmpty) 'other': other,
    if (fragment != null) 'fragment': fragment,
  };
}