IsolationLevel enum
Transaction isolation levels for database transactions.
Isolation levels control how transactions interact with concurrent transactions and what data they can see. Higher isolation levels provide better consistency but may reduce concurrency.
Example:
final txnId = await service.beginTransaction(
connectionId,
IsolationLevel.readCommitted,
);
Values
- readUncommitted → const IsolationLevel
-
Read uncommitted - lowest isolation level.
Allows dirty reads, non-repeatable reads, and phantom reads. Transactions can see uncommitted changes from other transactions.
const IsolationLevel(0) - readCommitted → const IsolationLevel
-
Read committed - default for most databases.
Prevents dirty reads but allows non-repeatable reads and phantom reads. Transactions can only see committed changes.
const IsolationLevel(1) - repeatableRead → const IsolationLevel
-
Repeatable read - prevents non-repeatable reads.
Prevents dirty reads and non-repeatable reads but allows phantom reads. Same query within a transaction always returns the same results.
const IsolationLevel(2) - serializable → const IsolationLevel
-
Serializable - highest isolation level.
Prevents all concurrency issues: dirty reads, non-repeatable reads, and phantom reads. Provides the strongest consistency guarantees.
const IsolationLevel(3)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → int
-
Numeric value used by the ODBC driver for this isolation level.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
IsolationLevel> - A constant List of the values in this enum, in order of their declaration.