forked from loafle/openapi-generator-original
[dart] Fix switch on enums not possible (#8512)
All enum instances are `const` so `equals/hashCode` is not needed. Removing this allows to `switch/case` on enum instances.
This commit is contained in:
parent
c55bee1273
commit
201acbd3de
@ -6,13 +6,6 @@ class {{{classname}}} {
|
||||
/// The underlying value of this enum member.
|
||||
final {{{dataType}}} value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is {{{classname}}} && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value{{^isString}}.toString(){{/isString}};
|
||||
|
||||
|
@ -6,13 +6,6 @@ class {{{classname}}}{{{enumName}}} {
|
||||
/// The underlying value of this enum member.
|
||||
final {{{dataType}}} value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is {{{classname}}}{{{enumName}}} && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value{{^isString}}.toString(){{/isString}};
|
||||
|
||||
|
@ -125,13 +125,6 @@ class OrderStatusEnum {
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is OrderStatusEnum && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
|
@ -125,13 +125,6 @@ class PetStatusEnum {
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is PetStatusEnum && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
|
@ -125,13 +125,6 @@ class OrderStatusEnum {
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is OrderStatusEnum && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
|
@ -125,13 +125,6 @@ class PetStatusEnum {
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is PetStatusEnum && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
|
@ -86,13 +86,6 @@ class EnumArraysJustSymbolEnum {
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is EnumArraysJustSymbolEnum && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
@ -159,13 +152,6 @@ class EnumArraysArrayEnumEnum {
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is EnumArraysArrayEnumEnum && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
|
@ -17,13 +17,6 @@ class EnumClass {
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is EnumClass && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
|
@ -140,13 +140,6 @@ class EnumTestEnumStringEnum {
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is EnumTestEnumStringEnum && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
@ -216,13 +209,6 @@ class EnumTestEnumStringRequiredEnum {
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is EnumTestEnumStringRequiredEnum && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
@ -292,13 +278,6 @@ class EnumTestEnumIntegerEnum {
|
||||
/// The underlying value of this enum member.
|
||||
final int value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is EnumTestEnumIntegerEnum && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value.toString();
|
||||
|
||||
@ -365,13 +344,6 @@ class EnumTestEnumNumberEnum {
|
||||
/// The underlying value of this enum member.
|
||||
final double value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is EnumTestEnumNumberEnum && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value.toString();
|
||||
|
||||
|
@ -112,13 +112,6 @@ class MapTestInnerEnum {
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is MapTestInnerEnum && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
|
@ -125,13 +125,6 @@ class OrderStatusEnum {
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is OrderStatusEnum && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
|
@ -17,13 +17,6 @@ class OuterEnum {
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is OuterEnum && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
|
@ -17,13 +17,6 @@ class OuterEnumDefaultValue {
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is OuterEnumDefaultValue && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
|
@ -17,13 +17,6 @@ class OuterEnumInteger {
|
||||
/// The underlying value of this enum member.
|
||||
final int value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is OuterEnumInteger && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value.toString();
|
||||
|
||||
|
@ -17,13 +17,6 @@ class OuterEnumIntegerDefaultValue {
|
||||
/// The underlying value of this enum member.
|
||||
final int value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is OuterEnumIntegerDefaultValue && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value.toString();
|
||||
|
||||
|
@ -125,13 +125,6 @@ class PetStatusEnum {
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) ||
|
||||
other is PetStatusEnum && other.value == value;
|
||||
|
||||
@override
|
||||
int get hashCode => toString().hashCode;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user