From ecba435fc5a7cc090a7eb31c19962d3333b36eaf Mon Sep 17 00:00:00 2001 From: Ashita Prasad Date: Mon, 24 Feb 2025 07:20:56 +0530 Subject: [PATCH] Remove custom environment model --- .../lib/models/insomnia_environment.dart | 60 --- .../models/insomnia_environment.freezed.dart | 496 ------------------ .../lib/models/insomnia_environment.g.dart | 47 -- 3 files changed, 603 deletions(-) delete mode 100644 packages/insomnia_collection/lib/models/insomnia_environment.dart delete mode 100644 packages/insomnia_collection/lib/models/insomnia_environment.freezed.dart delete mode 100644 packages/insomnia_collection/lib/models/insomnia_environment.g.dart diff --git a/packages/insomnia_collection/lib/models/insomnia_environment.dart b/packages/insomnia_collection/lib/models/insomnia_environment.dart deleted file mode 100644 index ef32a756..00000000 --- a/packages/insomnia_collection/lib/models/insomnia_environment.dart +++ /dev/null @@ -1,60 +0,0 @@ -import 'dart:convert'; -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'insomnia_environment.freezed.dart'; -part 'insomnia_environment.g.dart'; - -@freezed -class InsomniaEnvironment with _$InsomniaEnvironment { - @JsonSerializable( - explicitToJson: true, - anyMap: true, - includeIfNull: false, - ) - const factory InsomniaEnvironment({ - @JsonKey(name: '_id') String? id, - String? name, - @JsonKey(name: 'kvPairData') List? resources , - @JsonKey(name: '_type') String? type, - }) = _InsomniaEnvironment; - - factory InsomniaEnvironment.fromJson(Map json) => - _$InsomniaEnvironmentFromJson(json); -} - -InsomniaEnvironment insomniaEnvironmentFromJsonStr(String str) { - var insomniaJson = json.decode(str); - return InsomniaEnvironment.fromJson(insomniaJson); -} - -String insomniaEnvironmentToJsonStr(InsomniaEnvironment environment) { - return json.encode(environment.toJson()); -} - -@freezed -class EnvironmentVariable with _$EnvironmentVariable { - @JsonSerializable( - explicitToJson: true, - anyMap: true, - includeIfNull: false, - ) - const factory EnvironmentVariable({ - String? id, - @JsonKey(name: 'name') required String key, - @JsonKey(name: 'value') required String value, - String? type, - @JsonKey(name: 'enabled') bool? enabled, - }) = _EnvironmentVariable; - - factory EnvironmentVariable.fromJson(Map json) => - _$EnvironmentVariableFromJson(json); -} - -EnvironmentVariable environmentVariableFromJsonStr(String str) { - var environmentJson = json.decode(str); - return EnvironmentVariable.fromJson(environmentJson); -} - -String environmentVariableToJsonStr(EnvironmentVariable variable) { - return json.encode(variable.toJson()); -} \ No newline at end of file diff --git a/packages/insomnia_collection/lib/models/insomnia_environment.freezed.dart b/packages/insomnia_collection/lib/models/insomnia_environment.freezed.dart deleted file mode 100644 index ab073b42..00000000 --- a/packages/insomnia_collection/lib/models/insomnia_environment.freezed.dart +++ /dev/null @@ -1,496 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'insomnia_environment.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -InsomniaEnvironment _$InsomniaEnvironmentFromJson(Map json) { - return _InsomniaEnvironment.fromJson(json); -} - -/// @nodoc -mixin _$InsomniaEnvironment { - @JsonKey(name: '_id') - String? get id => throw _privateConstructorUsedError; - String? get name => throw _privateConstructorUsedError; - @JsonKey(name: 'kvPairData') - List? get resources => - throw _privateConstructorUsedError; - @JsonKey(name: '_type') - String? get type => throw _privateConstructorUsedError; - - /// Serializes this InsomniaEnvironment to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of InsomniaEnvironment - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $InsomniaEnvironmentCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $InsomniaEnvironmentCopyWith<$Res> { - factory $InsomniaEnvironmentCopyWith( - InsomniaEnvironment value, $Res Function(InsomniaEnvironment) then) = - _$InsomniaEnvironmentCopyWithImpl<$Res, InsomniaEnvironment>; - @useResult - $Res call( - {@JsonKey(name: '_id') String? id, - String? name, - @JsonKey(name: 'kvPairData') List? resources, - @JsonKey(name: '_type') String? type}); -} - -/// @nodoc -class _$InsomniaEnvironmentCopyWithImpl<$Res, $Val extends InsomniaEnvironment> - implements $InsomniaEnvironmentCopyWith<$Res> { - _$InsomniaEnvironmentCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of InsomniaEnvironment - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = freezed, - Object? name = freezed, - Object? resources = freezed, - Object? type = freezed, - }) { - return _then(_value.copyWith( - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String?, - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - resources: freezed == resources - ? _value.resources - : resources // ignore: cast_nullable_to_non_nullable - as List?, - type: freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$InsomniaEnvironmentImplCopyWith<$Res> - implements $InsomniaEnvironmentCopyWith<$Res> { - factory _$$InsomniaEnvironmentImplCopyWith(_$InsomniaEnvironmentImpl value, - $Res Function(_$InsomniaEnvironmentImpl) then) = - __$$InsomniaEnvironmentImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {@JsonKey(name: '_id') String? id, - String? name, - @JsonKey(name: 'kvPairData') List? resources, - @JsonKey(name: '_type') String? type}); -} - -/// @nodoc -class __$$InsomniaEnvironmentImplCopyWithImpl<$Res> - extends _$InsomniaEnvironmentCopyWithImpl<$Res, _$InsomniaEnvironmentImpl> - implements _$$InsomniaEnvironmentImplCopyWith<$Res> { - __$$InsomniaEnvironmentImplCopyWithImpl(_$InsomniaEnvironmentImpl _value, - $Res Function(_$InsomniaEnvironmentImpl) _then) - : super(_value, _then); - - /// Create a copy of InsomniaEnvironment - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = freezed, - Object? name = freezed, - Object? resources = freezed, - Object? type = freezed, - }) { - return _then(_$InsomniaEnvironmentImpl( - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String?, - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - resources: freezed == resources - ? _value._resources - : resources // ignore: cast_nullable_to_non_nullable - as List?, - type: freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc - -@JsonSerializable(explicitToJson: true, anyMap: true, includeIfNull: false) -class _$InsomniaEnvironmentImpl implements _InsomniaEnvironment { - const _$InsomniaEnvironmentImpl( - {@JsonKey(name: '_id') this.id, - this.name, - @JsonKey(name: 'kvPairData') final List? resources, - @JsonKey(name: '_type') this.type}) - : _resources = resources; - - factory _$InsomniaEnvironmentImpl.fromJson(Map json) => - _$$InsomniaEnvironmentImplFromJson(json); - - @override - @JsonKey(name: '_id') - final String? id; - @override - final String? name; - final List? _resources; - @override - @JsonKey(name: 'kvPairData') - List? get resources { - final value = _resources; - if (value == null) return null; - if (_resources is EqualUnmodifiableListView) return _resources; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override - @JsonKey(name: '_type') - final String? type; - - @override - String toString() { - return 'InsomniaEnvironment(id: $id, name: $name, resources: $resources, type: $type)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$InsomniaEnvironmentImpl && - (identical(other.id, id) || other.id == id) && - (identical(other.name, name) || other.name == name) && - const DeepCollectionEquality() - .equals(other._resources, _resources) && - (identical(other.type, type) || other.type == type)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, id, name, - const DeepCollectionEquality().hash(_resources), type); - - /// Create a copy of InsomniaEnvironment - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$InsomniaEnvironmentImplCopyWith<_$InsomniaEnvironmentImpl> get copyWith => - __$$InsomniaEnvironmentImplCopyWithImpl<_$InsomniaEnvironmentImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$InsomniaEnvironmentImplToJson( - this, - ); - } -} - -abstract class _InsomniaEnvironment implements InsomniaEnvironment { - const factory _InsomniaEnvironment( - {@JsonKey(name: '_id') final String? id, - final String? name, - @JsonKey(name: 'kvPairData') final List? resources, - @JsonKey(name: '_type') final String? type}) = _$InsomniaEnvironmentImpl; - - factory _InsomniaEnvironment.fromJson(Map json) = - _$InsomniaEnvironmentImpl.fromJson; - - @override - @JsonKey(name: '_id') - String? get id; - @override - String? get name; - @override - @JsonKey(name: 'kvPairData') - List? get resources; - @override - @JsonKey(name: '_type') - String? get type; - - /// Create a copy of InsomniaEnvironment - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$InsomniaEnvironmentImplCopyWith<_$InsomniaEnvironmentImpl> get copyWith => - throw _privateConstructorUsedError; -} - -EnvironmentVariable _$EnvironmentVariableFromJson(Map json) { - return _EnvironmentVariable.fromJson(json); -} - -/// @nodoc -mixin _$EnvironmentVariable { - String? get id => throw _privateConstructorUsedError; - @JsonKey(name: 'name') - String get key => throw _privateConstructorUsedError; - @JsonKey(name: 'value') - String get value => throw _privateConstructorUsedError; - String? get type => throw _privateConstructorUsedError; - @JsonKey(name: 'enabled') - bool? get enabled => throw _privateConstructorUsedError; - - /// Serializes this EnvironmentVariable to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of EnvironmentVariable - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $EnvironmentVariableCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $EnvironmentVariableCopyWith<$Res> { - factory $EnvironmentVariableCopyWith( - EnvironmentVariable value, $Res Function(EnvironmentVariable) then) = - _$EnvironmentVariableCopyWithImpl<$Res, EnvironmentVariable>; - @useResult - $Res call( - {String? id, - @JsonKey(name: 'name') String key, - @JsonKey(name: 'value') String value, - String? type, - @JsonKey(name: 'enabled') bool? enabled}); -} - -/// @nodoc -class _$EnvironmentVariableCopyWithImpl<$Res, $Val extends EnvironmentVariable> - implements $EnvironmentVariableCopyWith<$Res> { - _$EnvironmentVariableCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of EnvironmentVariable - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = freezed, - Object? key = null, - Object? value = null, - Object? type = freezed, - Object? enabled = freezed, - }) { - return _then(_value.copyWith( - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String?, - key: null == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as String, - value: null == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as String, - type: freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - enabled: freezed == enabled - ? _value.enabled - : enabled // ignore: cast_nullable_to_non_nullable - as bool?, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$EnvironmentVariableImplCopyWith<$Res> - implements $EnvironmentVariableCopyWith<$Res> { - factory _$$EnvironmentVariableImplCopyWith(_$EnvironmentVariableImpl value, - $Res Function(_$EnvironmentVariableImpl) then) = - __$$EnvironmentVariableImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String? id, - @JsonKey(name: 'name') String key, - @JsonKey(name: 'value') String value, - String? type, - @JsonKey(name: 'enabled') bool? enabled}); -} - -/// @nodoc -class __$$EnvironmentVariableImplCopyWithImpl<$Res> - extends _$EnvironmentVariableCopyWithImpl<$Res, _$EnvironmentVariableImpl> - implements _$$EnvironmentVariableImplCopyWith<$Res> { - __$$EnvironmentVariableImplCopyWithImpl(_$EnvironmentVariableImpl _value, - $Res Function(_$EnvironmentVariableImpl) _then) - : super(_value, _then); - - /// Create a copy of EnvironmentVariable - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = freezed, - Object? key = null, - Object? value = null, - Object? type = freezed, - Object? enabled = freezed, - }) { - return _then(_$EnvironmentVariableImpl( - id: freezed == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String?, - key: null == key - ? _value.key - : key // ignore: cast_nullable_to_non_nullable - as String, - value: null == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as String, - type: freezed == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String?, - enabled: freezed == enabled - ? _value.enabled - : enabled // ignore: cast_nullable_to_non_nullable - as bool?, - )); - } -} - -/// @nodoc - -@JsonSerializable(explicitToJson: true, anyMap: true, includeIfNull: false) -class _$EnvironmentVariableImpl implements _EnvironmentVariable { - const _$EnvironmentVariableImpl( - {this.id, - @JsonKey(name: 'name') required this.key, - @JsonKey(name: 'value') required this.value, - this.type, - @JsonKey(name: 'enabled') this.enabled}); - - factory _$EnvironmentVariableImpl.fromJson(Map json) => - _$$EnvironmentVariableImplFromJson(json); - - @override - final String? id; - @override - @JsonKey(name: 'name') - final String key; - @override - @JsonKey(name: 'value') - final String value; - @override - final String? type; - @override - @JsonKey(name: 'enabled') - final bool? enabled; - - @override - String toString() { - return 'EnvironmentVariable(id: $id, key: $key, value: $value, type: $type, enabled: $enabled)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$EnvironmentVariableImpl && - (identical(other.id, id) || other.id == id) && - (identical(other.key, key) || other.key == key) && - (identical(other.value, value) || other.value == value) && - (identical(other.type, type) || other.type == type) && - (identical(other.enabled, enabled) || other.enabled == enabled)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, id, key, value, type, enabled); - - /// Create a copy of EnvironmentVariable - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$EnvironmentVariableImplCopyWith<_$EnvironmentVariableImpl> get copyWith => - __$$EnvironmentVariableImplCopyWithImpl<_$EnvironmentVariableImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$EnvironmentVariableImplToJson( - this, - ); - } -} - -abstract class _EnvironmentVariable implements EnvironmentVariable { - const factory _EnvironmentVariable( - {final String? id, - @JsonKey(name: 'name') required final String key, - @JsonKey(name: 'value') required final String value, - final String? type, - @JsonKey(name: 'enabled') final bool? enabled}) = - _$EnvironmentVariableImpl; - - factory _EnvironmentVariable.fromJson(Map json) = - _$EnvironmentVariableImpl.fromJson; - - @override - String? get id; - @override - @JsonKey(name: 'name') - String get key; - @override - @JsonKey(name: 'value') - String get value; - @override - String? get type; - @override - @JsonKey(name: 'enabled') - bool? get enabled; - - /// Create a copy of EnvironmentVariable - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$EnvironmentVariableImplCopyWith<_$EnvironmentVariableImpl> get copyWith => - throw _privateConstructorUsedError; -} diff --git a/packages/insomnia_collection/lib/models/insomnia_environment.g.dart b/packages/insomnia_collection/lib/models/insomnia_environment.g.dart deleted file mode 100644 index 95a1c316..00000000 --- a/packages/insomnia_collection/lib/models/insomnia_environment.g.dart +++ /dev/null @@ -1,47 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'insomnia_environment.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_$InsomniaEnvironmentImpl _$$InsomniaEnvironmentImplFromJson(Map json) => - _$InsomniaEnvironmentImpl( - id: json['_id'] as String?, - name: json['name'] as String?, - resources: (json['kvPairData'] as List?) - ?.map((e) => - EnvironmentVariable.fromJson(Map.from(e as Map))) - .toList(), - type: json['_type'] as String?, - ); - -Map _$$InsomniaEnvironmentImplToJson( - _$InsomniaEnvironmentImpl instance) => - { - if (instance.id case final value?) '_id': value, - if (instance.name case final value?) 'name': value, - if (instance.resources?.map((e) => e.toJson()).toList() case final value?) - 'kvPairData': value, - if (instance.type case final value?) '_type': value, - }; - -_$EnvironmentVariableImpl _$$EnvironmentVariableImplFromJson(Map json) => - _$EnvironmentVariableImpl( - id: json['id'] as String?, - key: json['name'] as String, - value: json['value'] as String, - type: json['type'] as String?, - enabled: json['enabled'] as bool?, - ); - -Map _$$EnvironmentVariableImplToJson( - _$EnvironmentVariableImpl instance) => - { - if (instance.id case final value?) 'id': value, - 'name': instance.key, - 'value': instance.value, - if (instance.type case final value?) 'type': value, - if (instance.enabled case final value?) 'enabled': value, - };