RequestSqliteCache<TRequest> class
abstract
Serialize and Deserialize a Request from SQLite.
Constructors
-
RequestSqliteCache({required String attemptColumn, required String createdAtColumn, required String lockedColumn, required String primaryKeyColumn, required TRequest request, required List<
String> requestColumns, required String tableName, required String updateAtColumn}) - Matches any HTTP requests that send data (or 'push'). 'Pull' requests most often have an outcome that exists in memory (e.g. deserializing to a model). Since callbacks cannot be stored in SQLite and there's no guarantee of the destination existing (say disposal or a crash has since occurred), 'pull' requests will be ignored.
Properties
- attemptColumn → String
-
final
- createdAtColumn → String
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- lockedColumn → String
-
final
- primaryKeyColumn → String
-
final
- request → TRequest
-
final
-
requestColumns
→ List<
String> -
Columns used to uniquely identify the request (e.g. body, headers, url, method).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tableName → String
-
final
- updateAtColumn → String
-
final
Methods
-
attemptLogMessage(
Map< String, dynamic> responseFromSqlite) → String - The log output before each attempt
-
delete(
Database db) → Future< int> - Removes the request from the database and thus the queue
-
findRequestInDatabase(
DatabaseExecutor db) → Future< Map< String, dynamic> ?> -
insertOrUpdate(
Database db, {Logger? logger}) → Future< int> -
If the request already exists in the database, increment attemps and
set
updated_at
to current time. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sqliteToRequest(
Map< String, dynamic> data) → TRequest - Builds SQLite-row into a request
-
toSqlite(
) → Map< String, dynamic> -
Builds request into a new SQLite-insertable row
Only available if request was initialized from
fromRequest
-
toString(
) → String -
A string representation of this object.
inherited
-
unlock(
Database db) → Future< int?> - If the request did not succeed, unlock for subsequent processing
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
lockRequest(
{required DatabaseExecutor db, required Map< String, dynamic> data, required String lockedColumn, required String primaryKeyColumn, required String tableName}) → Future<int> -
unlockRequest(
{required DatabaseExecutor db, required Map< String, dynamic> data, required String lockedColumn, required String primaryKeyColumn, required String tableName}) → Future<int>