OutboxEvent.fromRow constructor

OutboxEvent.fromRow(
  1. Row row
)

Implementation

factory OutboxEvent.fromRow(Row row) {
  return OutboxEvent(
    id: row['id'] as int,
    localId: row['local_id'] as String,
    tableName: row['table_name'] as String,
    operation: row['operation'] as String,
    payload: jsonDecode(row['payload'] as String) as Map<String, dynamic>,
    state: row['state'] as String,
    createdAt: DateTime.parse(row['created_at'] as String),
    clientUpdatedAt: DateTime.parse(row['client_updated_at'] as String),
    attemptCount: row['attempt_count'] as int,
    lastAttemptAt: row['last_attempt_at'] != null
        ? DateTime.parse(row['last_attempt_at'] as String)
        : null,
    lastError: row['last_error'] as String?,
    serverId: row['server_id'] as String?,
  );
}