ResqliteQueryException class
An error caused by a SQL query — malformed SQL, constraint violations, or runtime execution failures.
try {
await db.execute('INSERT INTO users(id) VALUES (?)', [1]);
} on ResqliteQueryException catch (e) {
print(e.message); // "UNIQUE constraint failed: users.id"
print(e.sql); // "INSERT INTO users(id) VALUES (?)"
print(e.sqliteCode); // 19 (SQLITE_CONSTRAINT)
}
The sqliteCode is the raw SQLite result code. Common values:
1SQLITE_ERROR— generic5SQLITE_BUSY— another writer holds the lock19SQLITE_CONSTRAINT— a CHECK, UNIQUE, NOT NULL, or FOREIGN KEY constraint failed. Extended codes narrow it:787FK,1555PK,2067UNIQUE, etc.
- Inheritance
-
- Object
- ResqliteException
- ResqliteQueryException
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- message → String
-
A human-readable description of the error.
finalinherited
-
parameters
→ List<
Object?> ? -
The bound parameters, if any.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sql → String
-
The SQL statement that caused the error.
final
- sqliteCode → int?
-
The SQLite result code (e.g., 19 for SQLITE_CONSTRAINT).
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