DatabaseMigrationException class Null safety

An error encountered while calling in the course of an upgrade or downgrade.

Generally will be caused by an error thrown in the course of executing an Operation's forward or reverse operation. As this exception implements DatabaseException, if the underlying cause was a DatabaseException, then this exception itself can be used directly to query for common database errors, e.g.

try {
  // open database and migrate (if needed)
} on DatabaseMigrationException catch (err) {
    if (err.isOpenFailedError()) {
      // handle
    } else if (err.isSyntaxError()) {
      // handle
    } else {
      // handle
    }
}

If the underlying cause is other than a DatabaseException, which can often be the cause with custom Operations, the cause can be directly inspected as needed to properly handle the error.

Implemented types

Constructors

DatabaseMigrationException(int fromVersion, int toVersion, int problemVersion, dynamic cause)

Properties

cause ↔ dynamic
The original error thrown
read / write
fromVersion int
Starting version of the migration being performed when the error occurred
read / write
hashCode int
The hash code for this object.
read-onlyinherited
problemVersion int
The version whose migration(s) were being executed when the error occurred
read / write
result Object?
Platform specific error result.
read-onlyoverride
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
toVersion int
Target end version of the migration being performed when the error occurred
read / write

Methods

getResultCode() int?
Extended result code on Android/ffi, normal result code on iOS.
override
isDatabaseClosedError() bool
True if the exception is a database closed error
override
isDuplicateColumnError([String? column]) bool
True if the exception is a duplicate column error
override
isNoSuchTableError([String? table]) bool
True if the exception is a no such table exception
override
isNotNullConstraintError([String? field]) bool
True if the exception is a not null constraint error
override
isOpenFailedError() bool
True if the exception is an open failed error
override
isReadOnlyError() bool
True if the exception is a read-only error
override
isSyntaxError() bool
True if the exception is a syntax error
override
isUniqueConstraintError([String? field]) bool
True if the exception is a unique constraint error
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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