// // AUTO-GENERATED FILE, DO NOT MODIFY! // // @dart=2.0 // ignore_for_file: unused_element, unused_import // ignore_for_file: always_put_required_named_parameters_first // ignore_for_file: lines_longer_than_80_chars part of openapi.api; class ConnectionStatus { /// Instantiate a new enum with the provided [value]. const ConnectionStatus._(this.value); /// The underlying value of this enum member. final String value; @override String toString() => value; String toJson() => value; static const connected = ConnectionStatus._(r'Connected'); static const disconnected = ConnectionStatus._(r'Disconnected'); static const unknown = ConnectionStatus._(r'Unknown'); /// List of all possible values in this [enum][ConnectionStatus]. static const values = [ connected, disconnected, unknown, ]; static ConnectionStatus fromJson(dynamic value) => ConnectionStatusTypeTransformer().decode(value); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] : json .map((value) => ConnectionStatus.fromJson(value)) .toList(growable: true == growable); } /// Transformation class that can [encode] an instance of [ConnectionStatus] to String, /// and [decode] dynamic data back to [ConnectionStatus]. class ConnectionStatusTypeTransformer { const ConnectionStatusTypeTransformer._(); factory ConnectionStatusTypeTransformer() => _instance ??= ConnectionStatusTypeTransformer._(); String encode(ConnectionStatus data) => data.value; /// Decodes a [dynamic value][data] to a ConnectionStatus. /// /// 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. ConnectionStatus decode(dynamic data, {bool allowNull}) { switch (data) { case r'Connected': return ConnectionStatus.connected; case r'Disconnected': return ConnectionStatus.disconnected; case r'Unknown': return ConnectionStatus.unknown; default: if (allowNull == false) { throw ArgumentError('Unknown enum value to decode: $data'); } } return null; } /// Singleton [ConnectionStatusTypeTransformer] instance. static ConnectionStatusTypeTransformer _instance; }