T getEnumFromString<T>(Iterable<T> values, String str) { return values.firstWhere((f) => f.toString().split('.').last == str, orElse: null); }