sqliteToRequest method

  1. @override
Request sqliteToRequest(
  1. Map<String, dynamic> data
)

Builds SQLite-row into a request

Implementation

@override
http.Request sqliteToRequest(Map<String, dynamic> data) {
  final request = http.Request(
    data[HTTP_JOBS_REQUEST_METHOD_COLUMN],
    Uri.parse(data[HTTP_JOBS_URL_COLUMN]),
  );

  if (data[HTTP_JOBS_ENCODING_COLUMN] != null) {
    final encoding = Encoding.getByName(data[HTTP_JOBS_ENCODING_COLUMN]);
    if (encoding != null) request.encoding = encoding;
  }

  if (data[HTTP_JOBS_HEADERS_COLUMN] != null) {
    request.headers.addAll(Map<String, String>.from(jsonDecode(data[HTTP_JOBS_HEADERS_COLUMN])));
  }

  if (data[HTTP_JOBS_BODY_COLUMN] != null) {
    request.body = data[HTTP_JOBS_BODY_COLUMN];
  }

  return request;
}