|
- /*
- * @Author: your name
- * @Date: 2020-06-19 15:09:28
- * @LastEditTime: 2020-06-19 15:09:38
- * @LastEditors: Please set LastEditors
- * @Description: In User Settings Edit
- * @FilePath: /hairuyi_flutter_comm/lib/utils/enum_util.dart
- */
-
- ///枚举类型转string
- String enumToString(o) => o.toString().split('.').last;
-
- ///string转枚举类型
- T enumFromString<T>(Iterable<T> values, String value) {
- return values.firstWhere((type) => type.toString().split('.').last == value,
- orElse: () => null);
- }
|