基础库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

18 lines
509 B

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