ResqliteTransactionException class

An error raised by the library's own transaction control (BEGIN, COMMIT, ROLLBACK, SAVEPOINT, RELEASE). These statements are issued by resqlite, not by the caller, so there is no user-written SQL to surface — the operation field identifies which control statement failed and sqliteCode carries SQLite's reason.

The most common cause is a deferred foreign-key violation surfacing at COMMIT time:

try {
  await db.transaction((tx) async {
    await tx.execute('INSERT INTO child(pid) VALUES (?)', [999]);
  });
} on ResqliteTransactionException catch (e) {
  print(e.operation);  // 'commit'
  print(e.sqliteCode); // 787 (SQLITE_CONSTRAINT_FOREIGNKEY)
}
Inheritance

Constructors

ResqliteTransactionException(String message, {required String operation, int? sqliteCode})

Properties

hashCode int
The hash code for this object.
no setterinherited
message String
A human-readable description of the error.
finalinherited
operation String
The transaction control operation that failed: 'begin', 'commit', 'rollback', 'savepoint', 'release', or 'rollback_to'.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sqliteCode int?
The SQLite result code, if the failure came from SQLite.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited