enum Operation { /// 创建 create, /// 修改 update, /// 删除 delete, } /// Operation 枚举的扩展方法 extension OperationExtension on Operation { /// 获取操作的中文名 String get name { switch (this) { case Operation.create: return '创建'; case Operation.update: return '修改'; case Operation.delete: return '删除'; } } }