Returns an Enum Type given a String name
T? toEnum<T>(String? key, List<T> values) { try { return values.firstWhereOrNull((v) => key == fromEnum(v)); } catch (e) { return null; } }