OnDowngrade class

Annotation for define Migration(OnDowngrade) method for database. Prototype of the function called when the version has decreased. Schema migration (adding column, adding table, adding trigger...) should happen here. This annotation must be applied on a method in the database class. Method syntax is also important. Example:

@DB(
  name: 'note_db',
  version: 1,
  entities: [Note],
)
abstract class NoteDB {
  @OnDowngrade()
  Future<void> onDowngrade(Database db, int oldVersion, int newVersion) async {
    print('onDowngrade');
  }
}

Constructors

OnDowngrade()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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