fromCode static method

EventType fromCode(
  1. String code
)

Parsing from String code to EventType

Implementation

static EventType fromCode(String code) {
  switch (code.split('.').lastOrNull ?? code) {
    case 'create':
      return EventType.create;
    case 'update':
      return EventType.update;
    case 'delete':
      return EventType.delete;
    default:
      throw Exception('Unknown EventType code: $code');
  }
}