createMessageHeaders static method

MessageHeaders createMessageHeaders(
  1. List data
)

Implementation

static MessageHeaders createMessageHeaders(List<dynamic> data) {
  if (data.length < 2) {
    throw GeneralError("Invalid headers");
  } else {
    if (data[1] == null) return MessageHeaders();
    try {
      final _headers1 = new Map<String, String>.from(data[1]);
      final headers = MessageHeaders();
      _headers1.forEach((key, value) {
        headers.setHeaderValue(key, value);
      });
      return headers;
    } catch (_) {
      throw GeneralError("Invalid headers");
    }
  }
}