基础库
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.

enum_util.dart 271 B

4 years ago
12345678
  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. }