128 lines
3.6 KiB
Dart
128 lines
3.6 KiB
Dart
//
|
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
|
//
|
|
// @dart=2.18
|
|
|
|
// ignore_for_file: unused_element, unused_import
|
|
// ignore_for_file: always_put_required_named_parameters_first
|
|
// ignore_for_file: constant_identifier_names
|
|
// ignore_for_file: lines_longer_than_80_chars
|
|
|
|
part of openapi.api;
|
|
|
|
/// 0 = Point 0 = P 1 = Curve 1 = L 2 = Surface 2 = A 3 = Collapse -3 = Dontcare -2 = True -1 = False -1 = Unknown
|
|
class Dimension {
|
|
/// Instantiate a new enum with the provided [value].
|
|
const Dimension._(this.value);
|
|
|
|
/// The underlying value of this enum member.
|
|
final int value;
|
|
|
|
@override
|
|
String toString() => value.toString();
|
|
|
|
int toJson() => value;
|
|
|
|
static const number0 = Dimension._(0);
|
|
static const number02 = Dimension._(0);
|
|
static const number1 = Dimension._(1);
|
|
static const number12 = Dimension._(1);
|
|
static const number2 = Dimension._(2);
|
|
static const number22 = Dimension._(2);
|
|
static const number3 = Dimension._(3);
|
|
static const numberNegative3 = Dimension._(-3);
|
|
static const numberNegative2 = Dimension._(-2);
|
|
static const numberNegative1 = Dimension._(-1);
|
|
static const numberNegative12 = Dimension._(-1);
|
|
|
|
/// List of all possible values in this [enum][Dimension].
|
|
static const values = <Dimension>[
|
|
number0,
|
|
number02,
|
|
number1,
|
|
number12,
|
|
number2,
|
|
number22,
|
|
number3,
|
|
numberNegative3,
|
|
numberNegative2,
|
|
numberNegative1,
|
|
numberNegative12,
|
|
];
|
|
|
|
static Dimension? fromJson(dynamic value) =>
|
|
DimensionTypeTransformer().decode(value);
|
|
|
|
static List<Dimension> listFromJson(
|
|
dynamic json, {
|
|
bool growable = false,
|
|
}) {
|
|
final result = <Dimension>[];
|
|
if (json is List && json.isNotEmpty) {
|
|
for (final row in json) {
|
|
final value = Dimension.fromJson(row);
|
|
if (value != null) {
|
|
result.add(value);
|
|
}
|
|
}
|
|
}
|
|
return result.toList(growable: growable);
|
|
}
|
|
}
|
|
|
|
/// Transformation class that can [encode] an instance of [Dimension] to int,
|
|
/// and [decode] dynamic data back to [Dimension].
|
|
class DimensionTypeTransformer {
|
|
factory DimensionTypeTransformer() =>
|
|
_instance ??= const DimensionTypeTransformer._();
|
|
|
|
const DimensionTypeTransformer._();
|
|
|
|
int encode(Dimension data) => data.value;
|
|
|
|
/// Decodes a [dynamic value][data] to a Dimension.
|
|
///
|
|
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
|
|
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
|
|
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
|
|
///
|
|
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
|
/// and users are still using an old app with the old code.
|
|
Dimension? decode(dynamic data, {bool allowNull = true}) {
|
|
if (data != null) {
|
|
switch (data) {
|
|
case 0:
|
|
return Dimension.number0;
|
|
case 0:
|
|
return Dimension.number02;
|
|
case 1:
|
|
return Dimension.number1;
|
|
case 1:
|
|
return Dimension.number12;
|
|
case 2:
|
|
return Dimension.number2;
|
|
case 2:
|
|
return Dimension.number22;
|
|
case 3:
|
|
return Dimension.number3;
|
|
case -3:
|
|
return Dimension.numberNegative3;
|
|
case -2:
|
|
return Dimension.numberNegative2;
|
|
case -1:
|
|
return Dimension.numberNegative1;
|
|
case -1:
|
|
return Dimension.numberNegative12;
|
|
default:
|
|
if (!allowNull) {
|
|
throw ArgumentError('Unknown enum value to decode: $data');
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/// Singleton [DimensionTypeTransformer] instance.
|
|
static DimensionTypeTransformer? _instance;
|
|
}
|