基础库
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

9 lines
271 B

  1. ///枚举类型转string
  2. String enumToString(o) => o.toString().split('.').last;
  3. ///string转枚举类型
  4. T enumFromString<T>(Iterable<T> values, String value) {
  5. return values.firstWhere((type) => type.toString().split('.').last == value,
  6. orElse: () => null);
  7. }