getContentLength static method

int? getContentLength(
  1. Map<String, List<String>> headers
)

Get Content-Length header

Implementation

static int? getContentLength(Map<String, List<String>> headers) {
  final contentLengthHeader =
      headers['content-length'] ?? headers['Content-Length'];
  if (contentLengthHeader != null && contentLengthHeader.isNotEmpty) {
    final headerValue = contentLengthHeader.first;
    return int.tryParse(headerValue);
  }
  return null;
}