| 1234567891011121314151617181920212223242526 |
- /// 上传状态
- enum UploadState {
- /// 上传成功
- success("success"),
- /// 上传中
- uploading("uploading"),
- /// 上传失败
- fail("fail");
- final String state;
- const UploadState(this.state);
- /// 通过状态字符串,获取对应的状态枚举
- static UploadState fromString(String state) {
- return values.firstWhere(
- (e) => e.state == state,
- orElse: () => throw ArgumentError('无效的状态值: $state'),
- );
- }
- @override
- String toString() => state;
- }
|