Update APIType in request model

This commit is contained in:
Ashita Prasad
2024-12-10 05:09:39 +05:30
parent a6791f1165
commit 46df82185d
3 changed files with 31 additions and 1 deletions

View File

@ -12,6 +12,7 @@ class RequestModel with _$RequestModel {
)
const factory RequestModel({
required String id,
@Default(APIType.rest) APIType apiType,
@Default("") String name,
@Default("") String description,
@JsonKey(includeToJson: false) @Default(0) requestTabIndex,

View File

@ -21,6 +21,7 @@ RequestModel _$RequestModelFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$RequestModel {
String get id => throw _privateConstructorUsedError;
APIType get apiType => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String get description => throw _privateConstructorUsedError;
@JsonKey(includeToJson: false)
@ -53,6 +54,7 @@ abstract class $RequestModelCopyWith<$Res> {
@useResult
$Res call(
{String id,
APIType apiType,
String name,
String description,
@JsonKey(includeToJson: false) dynamic requestTabIndex,
@ -83,6 +85,7 @@ class _$RequestModelCopyWithImpl<$Res, $Val extends RequestModel>
@override
$Res call({
Object? id = null,
Object? apiType = null,
Object? name = null,
Object? description = null,
Object? requestTabIndex = freezed,
@ -98,6 +101,10 @@ class _$RequestModelCopyWithImpl<$Res, $Val extends RequestModel>
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
apiType: null == apiType
? _value.apiType
: apiType // ignore: cast_nullable_to_non_nullable
as APIType,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
@ -176,6 +183,7 @@ abstract class _$$RequestModelImplCopyWith<$Res>
@useResult
$Res call(
{String id,
APIType apiType,
String name,
String description,
@JsonKey(includeToJson: false) dynamic requestTabIndex,
@ -206,6 +214,7 @@ class __$$RequestModelImplCopyWithImpl<$Res>
@override
$Res call({
Object? id = null,
Object? apiType = null,
Object? name = null,
Object? description = null,
Object? requestTabIndex = freezed,
@ -221,6 +230,10 @@ class __$$RequestModelImplCopyWithImpl<$Res>
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
apiType: null == apiType
? _value.apiType
: apiType // ignore: cast_nullable_to_non_nullable
as APIType,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
@ -266,6 +279,7 @@ class __$$RequestModelImplCopyWithImpl<$Res>
class _$RequestModelImpl implements _RequestModel {
const _$RequestModelImpl(
{required this.id,
this.apiType = APIType.rest,
this.name = "",
this.description = "",
@JsonKey(includeToJson: false) this.requestTabIndex = 0,
@ -283,6 +297,9 @@ class _$RequestModelImpl implements _RequestModel {
final String id;
@override
@JsonKey()
final APIType apiType;
@override
@JsonKey()
final String name;
@override
@JsonKey()
@ -307,7 +324,7 @@ class _$RequestModelImpl implements _RequestModel {
@override
String toString() {
return 'RequestModel(id: $id, name: $name, description: $description, requestTabIndex: $requestTabIndex, httpRequestModel: $httpRequestModel, responseStatus: $responseStatus, message: $message, httpResponseModel: $httpResponseModel, isWorking: $isWorking, sendingTime: $sendingTime)';
return 'RequestModel(id: $id, apiType: $apiType, name: $name, description: $description, requestTabIndex: $requestTabIndex, httpRequestModel: $httpRequestModel, responseStatus: $responseStatus, message: $message, httpResponseModel: $httpResponseModel, isWorking: $isWorking, sendingTime: $sendingTime)';
}
@override
@ -316,6 +333,7 @@ class _$RequestModelImpl implements _RequestModel {
(other.runtimeType == runtimeType &&
other is _$RequestModelImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.apiType, apiType) || other.apiType == apiType) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.description, description) ||
other.description == description) &&
@ -339,6 +357,7 @@ class _$RequestModelImpl implements _RequestModel {
int get hashCode => Object.hash(
runtimeType,
id,
apiType,
name,
description,
const DeepCollectionEquality().hash(requestTabIndex),
@ -368,6 +387,7 @@ class _$RequestModelImpl implements _RequestModel {
abstract class _RequestModel implements RequestModel {
const factory _RequestModel(
{required final String id,
final APIType apiType,
final String name,
final String description,
@JsonKey(includeToJson: false) final dynamic requestTabIndex,
@ -385,6 +405,8 @@ abstract class _RequestModel implements RequestModel {
@override
String get id;
@override
APIType get apiType;
@override
String get name;
@override
String get description;

View File

@ -8,6 +8,8 @@ part of 'request_model.dart';
_$RequestModelImpl _$$RequestModelImplFromJson(Map json) => _$RequestModelImpl(
id: json['id'] as String,
apiType: $enumDecodeNullable(_$APITypeEnumMap, json['apiType']) ??
APIType.rest,
name: json['name'] as String? ?? "",
description: json['description'] as String? ?? "",
requestTabIndex: json['requestTabIndex'] ?? 0,
@ -30,6 +32,7 @@ _$RequestModelImpl _$$RequestModelImplFromJson(Map json) => _$RequestModelImpl(
Map<String, dynamic> _$$RequestModelImplToJson(_$RequestModelImpl instance) =>
<String, dynamic>{
'id': instance.id,
'apiType': _$APITypeEnumMap[instance.apiType]!,
'name': instance.name,
'description': instance.description,
'httpRequestModel': instance.httpRequestModel?.toJson(),
@ -37,3 +40,7 @@ Map<String, dynamic> _$$RequestModelImplToJson(_$RequestModelImpl instance) =>
'message': instance.message,
'httpResponseModel': instance.httpResponseModel?.toJson(),
};
const _$APITypeEnumMap = {
APIType.rest: 'rest',
};