defaultTypeResolver function

String defaultTypeResolver(
  1. Type type
)

Implementation

String defaultTypeResolver(Type type) {
  switch (type) {
    case == Move:
      return 'Move';
    case == Spell:
      return 'Spell';
    case == Item:
      return 'Item';
    case == CharacterClass:
      return 'CharacterClass';
    case == Race:
      return 'Race';
    case == GearSelection:
      return 'GearSelection';
    case == MoveCategory:
      return 'MoveCategory';
    case == Tag:
      return 'Tag';
    case == Dice:
      return 'Dice';
    default:
      final typeString = type.toString();
      final match = RegExp(r'\w+', caseSensitive: false).firstMatch(typeString);
      return match?.group(0) ?? typeString;
  }
}