toSqlite method

  1. @override
Map<String, dynamic> toSqlite()

Builds request into a new SQLite-insertable row Only available if request was initialized from sqliteToRequest

This is a function to ensure DateTime.now() is invoked predictably.

Implementation

@override
Map<String, dynamic> toSqlite() => {
      HTTP_JOBS_ATTEMPTS_COLUMN: 1,
      HTTP_JOBS_BODY_COLUMN: request.body,
      HTTP_JOBS_CREATED_AT_COLUMN: DateTime.now().millisecondsSinceEpoch,
      HTTP_JOBS_ENCODING_COLUMN: request.encoding.name,
      HTTP_JOBS_HEADERS_COLUMN: jsonEncode(request.headers),
      HTTP_JOBS_REQUEST_METHOD_COLUMN: request.method,
      HTTP_JOBS_UPDATED_AT: DateTime.now().millisecondsSinceEpoch,
      HTTP_JOBS_URL_COLUMN: request.url.toString(),
    };