profile dependencies added
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
// ignore_for_file: invalid_annotation_target
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../profile_data/profile_data.dart';
|
||||
|
||||
part 'profile_response.freezed.dart';
|
||||
part 'profile_response.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class ProfileResponse with _$ProfileResponse {
|
||||
const factory ProfileResponse({
|
||||
required String? message,
|
||||
required bool? success,
|
||||
required ProfileData? data,
|
||||
}) = _ProfileResponse;
|
||||
|
||||
factory ProfileResponse.fromJson(Map<String, Object?> json) =>
|
||||
_$ProfileResponseFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// 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 'profile_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ProfileResponse {
|
||||
|
||||
String? get message; bool? get success; ProfileData? get data;
|
||||
/// Create a copy of ProfileResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$ProfileResponseCopyWith<ProfileResponse> get copyWith => _$ProfileResponseCopyWithImpl<ProfileResponse>(this as ProfileResponse, _$identity);
|
||||
|
||||
/// Serializes this ProfileResponse to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ProfileResponse&&(identical(other.message, message) || other.message == message)&&(identical(other.success, success) || other.success == success)&&(identical(other.data, data) || other.data == data));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,message,success,data);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfileResponse(message: $message, success: $success, data: $data)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $ProfileResponseCopyWith<$Res> {
|
||||
factory $ProfileResponseCopyWith(ProfileResponse value, $Res Function(ProfileResponse) _then) = _$ProfileResponseCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String? message, bool? success, ProfileData? data
|
||||
});
|
||||
|
||||
|
||||
$ProfileDataCopyWith<$Res>? get data;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$ProfileResponseCopyWithImpl<$Res>
|
||||
implements $ProfileResponseCopyWith<$Res> {
|
||||
_$ProfileResponseCopyWithImpl(this._self, this._then);
|
||||
|
||||
final ProfileResponse _self;
|
||||
final $Res Function(ProfileResponse) _then;
|
||||
|
||||
/// Create a copy of ProfileResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? message = freezed,Object? success = freezed,Object? data = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||
as String?,success: freezed == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
|
||||
as ProfileData?,
|
||||
));
|
||||
}
|
||||
/// Create a copy of ProfileResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ProfileDataCopyWith<$Res>? get data {
|
||||
if (_self.data == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ProfileDataCopyWith<$Res>(_self.data!, (value) {
|
||||
return _then(_self.copyWith(data: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [ProfileResponse].
|
||||
extension ProfileResponsePatterns on ProfileResponse {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ProfileResponse value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ProfileResponse() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ProfileResponse value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ProfileResponse():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ProfileResponse value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ProfileResponse() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? message, bool? success, ProfileData? data)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ProfileResponse() when $default != null:
|
||||
return $default(_that.message,_that.success,_that.data);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? message, bool? success, ProfileData? data) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ProfileResponse():
|
||||
return $default(_that.message,_that.success,_that.data);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? message, bool? success, ProfileData? data)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ProfileResponse() when $default != null:
|
||||
return $default(_that.message,_that.success,_that.data);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _ProfileResponse implements ProfileResponse {
|
||||
const _ProfileResponse({required this.message, required this.success, required this.data});
|
||||
factory _ProfileResponse.fromJson(Map<String, dynamic> json) => _$ProfileResponseFromJson(json);
|
||||
|
||||
@override final String? message;
|
||||
@override final bool? success;
|
||||
@override final ProfileData? data;
|
||||
|
||||
/// Create a copy of ProfileResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ProfileResponseCopyWith<_ProfileResponse> get copyWith => __$ProfileResponseCopyWithImpl<_ProfileResponse>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$ProfileResponseToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ProfileResponse&&(identical(other.message, message) || other.message == message)&&(identical(other.success, success) || other.success == success)&&(identical(other.data, data) || other.data == data));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,message,success,data);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfileResponse(message: $message, success: $success, data: $data)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ProfileResponseCopyWith<$Res> implements $ProfileResponseCopyWith<$Res> {
|
||||
factory _$ProfileResponseCopyWith(_ProfileResponse value, $Res Function(_ProfileResponse) _then) = __$ProfileResponseCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String? message, bool? success, ProfileData? data
|
||||
});
|
||||
|
||||
|
||||
@override $ProfileDataCopyWith<$Res>? get data;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ProfileResponseCopyWithImpl<$Res>
|
||||
implements _$ProfileResponseCopyWith<$Res> {
|
||||
__$ProfileResponseCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _ProfileResponse _self;
|
||||
final $Res Function(_ProfileResponse) _then;
|
||||
|
||||
/// Create a copy of ProfileResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? message = freezed,Object? success = freezed,Object? data = freezed,}) {
|
||||
return _then(_ProfileResponse(
|
||||
message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||
as String?,success: freezed == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
|
||||
as ProfileData?,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of ProfileResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ProfileDataCopyWith<$Res>? get data {
|
||||
if (_self.data == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ProfileDataCopyWith<$Res>(_self.data!, (value) {
|
||||
return _then(_self.copyWith(data: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,24 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'profile_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_ProfileResponse _$ProfileResponseFromJson(Map<String, dynamic> json) =>
|
||||
_ProfileResponse(
|
||||
message: json['message'] as String?,
|
||||
success: json['success'] as bool?,
|
||||
data:
|
||||
json['data'] == null
|
||||
? null
|
||||
: ProfileData.fromJson(json['data'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ProfileResponseToJson(_ProfileResponse instance) =>
|
||||
<String, dynamic>{
|
||||
'message': instance.message,
|
||||
'success': instance.success,
|
||||
'data': instance.data,
|
||||
};
|
||||
Reference in New Issue
Block a user