typeName property

  1. @override
String get typeName

Stable identity of this event type in storage.

This is the string written to toMap()['type'] and to the eventType column of every stored envelope, and the key under which the type must be registered in EventRegistry and EventMigrationManager. It defaults to the Dart class name, which is fine until the class is renamed or the app is built with --obfuscate; from then on the default no longer matches the name already in the journal. Override it with a name that never changes:

class AccountOpened extends Event {
  @override
  String get typeName => 'account.opened';
}

An event type whose journal already holds the class name can be renamed by registering the old name as an alias; see EventRegistry.registerAlias.

Implementation

@override
String get typeName => stableTypeName;