Merge pull request 'feedback models added' (#39) from feedback_models into main
Reviewed-on: https://repo.ravanertebat.com/TM/tm_app/pulls/39
This commit is contained in:
@@ -27,7 +27,7 @@ class NetworkManager {
|
||||
final requestInterceptor = InterceptorsWrapper(
|
||||
onRequest: (options, handler) {
|
||||
appLogger.info('🌐 Request: ${options.method} ${options.path}');
|
||||
appLogger.info('🌐 Headers: ${options.headers}');
|
||||
// appLogger.info('🌐 Headers: ${options.headers}');
|
||||
return handler.next(options);
|
||||
},
|
||||
onResponse: (response, handler) {
|
||||
|
||||
@@ -20,4 +20,8 @@ class AuthRepository {
|
||||
Future<Result<LogoutResponse>> logout() async {
|
||||
return _authService.logout();
|
||||
}
|
||||
|
||||
Future<void> localLogout() async {
|
||||
return _authService.localLogout();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// ignore_for_file: invalid_annotation_target
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'error_model.freezed.dart';
|
||||
part 'error_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class ErrorModel with _$ErrorModel {
|
||||
const factory ErrorModel({
|
||||
required String? message,
|
||||
required String? code,
|
||||
required String? details,
|
||||
}) = _ErrorModel;
|
||||
|
||||
factory ErrorModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$ErrorModelFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
// 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 'error_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ErrorModel {
|
||||
|
||||
String? get message; String? get code; String? get details;
|
||||
/// Create a copy of ErrorModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$ErrorModelCopyWith<ErrorModel> get copyWith => _$ErrorModelCopyWithImpl<ErrorModel>(this as ErrorModel, _$identity);
|
||||
|
||||
/// Serializes this ErrorModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ErrorModel&&(identical(other.message, message) || other.message == message)&&(identical(other.code, code) || other.code == code)&&(identical(other.details, details) || other.details == details));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,message,code,details);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ErrorModel(message: $message, code: $code, details: $details)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $ErrorModelCopyWith<$Res> {
|
||||
factory $ErrorModelCopyWith(ErrorModel value, $Res Function(ErrorModel) _then) = _$ErrorModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String? message, String? code, String? details
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$ErrorModelCopyWithImpl<$Res>
|
||||
implements $ErrorModelCopyWith<$Res> {
|
||||
_$ErrorModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final ErrorModel _self;
|
||||
final $Res Function(ErrorModel) _then;
|
||||
|
||||
/// Create a copy of ErrorModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? message = freezed,Object? code = freezed,Object? details = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||
as String?,code: freezed == code ? _self.code : code // ignore: cast_nullable_to_non_nullable
|
||||
as String?,details: freezed == details ? _self.details : details // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [ErrorModel].
|
||||
extension ErrorModelPatterns on ErrorModel {
|
||||
/// 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( _ErrorModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ErrorModel() 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( _ErrorModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ErrorModel():
|
||||
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( _ErrorModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ErrorModel() 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, String? code, String? details)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ErrorModel() when $default != null:
|
||||
return $default(_that.message,_that.code,_that.details);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, String? code, String? details) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ErrorModel():
|
||||
return $default(_that.message,_that.code,_that.details);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, String? code, String? details)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ErrorModel() when $default != null:
|
||||
return $default(_that.message,_that.code,_that.details);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _ErrorModel implements ErrorModel {
|
||||
const _ErrorModel({required this.message, required this.code, required this.details});
|
||||
factory _ErrorModel.fromJson(Map<String, dynamic> json) => _$ErrorModelFromJson(json);
|
||||
|
||||
@override final String? message;
|
||||
@override final String? code;
|
||||
@override final String? details;
|
||||
|
||||
/// Create a copy of ErrorModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ErrorModelCopyWith<_ErrorModel> get copyWith => __$ErrorModelCopyWithImpl<_ErrorModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$ErrorModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ErrorModel&&(identical(other.message, message) || other.message == message)&&(identical(other.code, code) || other.code == code)&&(identical(other.details, details) || other.details == details));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,message,code,details);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ErrorModel(message: $message, code: $code, details: $details)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ErrorModelCopyWith<$Res> implements $ErrorModelCopyWith<$Res> {
|
||||
factory _$ErrorModelCopyWith(_ErrorModel value, $Res Function(_ErrorModel) _then) = __$ErrorModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String? message, String? code, String? details
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ErrorModelCopyWithImpl<$Res>
|
||||
implements _$ErrorModelCopyWith<$Res> {
|
||||
__$ErrorModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _ErrorModel _self;
|
||||
final $Res Function(_ErrorModel) _then;
|
||||
|
||||
/// Create a copy of ErrorModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? message = freezed,Object? code = freezed,Object? details = freezed,}) {
|
||||
return _then(_ErrorModel(
|
||||
message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||
as String?,code: freezed == code ? _self.code : code // ignore: cast_nullable_to_non_nullable
|
||||
as String?,details: freezed == details ? _self.details : details // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,20 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'error_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_ErrorModel _$ErrorModelFromJson(Map<String, dynamic> json) => _ErrorModel(
|
||||
message: json['message'] as String?,
|
||||
code: json['code'] as String?,
|
||||
details: json['details'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ErrorModelToJson(_ErrorModel instance) =>
|
||||
<String, dynamic>{
|
||||
'message': instance.message,
|
||||
'code': instance.code,
|
||||
'details': instance.details,
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
// ignore_for_file: invalid_annotation_target
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'feedback_data.freezed.dart';
|
||||
part 'feedback_data.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class FeedbackData with _$FeedbackData {
|
||||
const factory FeedbackData({
|
||||
@JsonKey(name: 'company_id') required String? companyId,
|
||||
@JsonKey(name: 'created_at') required int? createdAt,
|
||||
@JsonKey(name: 'customer_id') required String? customerId,
|
||||
@JsonKey(name: 'feedback_type') required String? feedbackType,
|
||||
@JsonKey(name: 'id') required String? id,
|
||||
@JsonKey(name: 'tender') required String? tender,
|
||||
@JsonKey(name: 'updated_at') required int? updatedAt,
|
||||
}) = _FeedbackData;
|
||||
|
||||
factory FeedbackData.fromJson(Map<String, dynamic> json) =>
|
||||
_$FeedbackDataFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
// 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 'feedback_data.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$FeedbackData {
|
||||
|
||||
@JsonKey(name: 'company_id') String? get companyId;@JsonKey(name: 'created_at') int? get createdAt;@JsonKey(name: 'customer_id') String? get customerId;@JsonKey(name: 'feedback_type') String? get feedbackType;@JsonKey(name: 'id') String? get id;@JsonKey(name: 'tender') String? get tender;@JsonKey(name: 'updated_at') int? get updatedAt;
|
||||
/// Create a copy of FeedbackData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$FeedbackDataCopyWith<FeedbackData> get copyWith => _$FeedbackDataCopyWithImpl<FeedbackData>(this as FeedbackData, _$identity);
|
||||
|
||||
/// Serializes this FeedbackData to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is FeedbackData&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.customerId, customerId) || other.customerId == customerId)&&(identical(other.feedbackType, feedbackType) || other.feedbackType == feedbackType)&&(identical(other.id, id) || other.id == id)&&(identical(other.tender, tender) || other.tender == tender)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,companyId,createdAt,customerId,feedbackType,id,tender,updatedAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'FeedbackData(companyId: $companyId, createdAt: $createdAt, customerId: $customerId, feedbackType: $feedbackType, id: $id, tender: $tender, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $FeedbackDataCopyWith<$Res> {
|
||||
factory $FeedbackDataCopyWith(FeedbackData value, $Res Function(FeedbackData) _then) = _$FeedbackDataCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'company_id') String? companyId,@JsonKey(name: 'created_at') int? createdAt,@JsonKey(name: 'customer_id') String? customerId,@JsonKey(name: 'feedback_type') String? feedbackType,@JsonKey(name: 'id') String? id,@JsonKey(name: 'tender') String? tender,@JsonKey(name: 'updated_at') int? updatedAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$FeedbackDataCopyWithImpl<$Res>
|
||||
implements $FeedbackDataCopyWith<$Res> {
|
||||
_$FeedbackDataCopyWithImpl(this._self, this._then);
|
||||
|
||||
final FeedbackData _self;
|
||||
final $Res Function(FeedbackData) _then;
|
||||
|
||||
/// Create a copy of FeedbackData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? companyId = freezed,Object? createdAt = freezed,Object? customerId = freezed,Object? feedbackType = freezed,Object? id = freezed,Object? tender = freezed,Object? updatedAt = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
companyId: freezed == companyId ? _self.companyId : companyId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int?,customerId: freezed == customerId ? _self.customerId : customerId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,feedbackType: freezed == feedbackType ? _self.feedbackType : feedbackType // ignore: cast_nullable_to_non_nullable
|
||||
as String?,id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,tender: freezed == tender ? _self.tender : tender // ignore: cast_nullable_to_non_nullable
|
||||
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [FeedbackData].
|
||||
extension FeedbackDataPatterns on FeedbackData {
|
||||
/// 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( _FeedbackData value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackData() 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( _FeedbackData value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackData():
|
||||
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( _FeedbackData value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackData() 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(@JsonKey(name: 'company_id') String? companyId, @JsonKey(name: 'created_at') int? createdAt, @JsonKey(name: 'customer_id') String? customerId, @JsonKey(name: 'feedback_type') String? feedbackType, @JsonKey(name: 'id') String? id, @JsonKey(name: 'tender') String? tender, @JsonKey(name: 'updated_at') int? updatedAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackData() when $default != null:
|
||||
return $default(_that.companyId,_that.createdAt,_that.customerId,_that.feedbackType,_that.id,_that.tender,_that.updatedAt);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(@JsonKey(name: 'company_id') String? companyId, @JsonKey(name: 'created_at') int? createdAt, @JsonKey(name: 'customer_id') String? customerId, @JsonKey(name: 'feedback_type') String? feedbackType, @JsonKey(name: 'id') String? id, @JsonKey(name: 'tender') String? tender, @JsonKey(name: 'updated_at') int? updatedAt) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackData():
|
||||
return $default(_that.companyId,_that.createdAt,_that.customerId,_that.feedbackType,_that.id,_that.tender,_that.updatedAt);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(@JsonKey(name: 'company_id') String? companyId, @JsonKey(name: 'created_at') int? createdAt, @JsonKey(name: 'customer_id') String? customerId, @JsonKey(name: 'feedback_type') String? feedbackType, @JsonKey(name: 'id') String? id, @JsonKey(name: 'tender') String? tender, @JsonKey(name: 'updated_at') int? updatedAt)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackData() when $default != null:
|
||||
return $default(_that.companyId,_that.createdAt,_that.customerId,_that.feedbackType,_that.id,_that.tender,_that.updatedAt);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _FeedbackData implements FeedbackData {
|
||||
const _FeedbackData({@JsonKey(name: 'company_id') required this.companyId, @JsonKey(name: 'created_at') required this.createdAt, @JsonKey(name: 'customer_id') required this.customerId, @JsonKey(name: 'feedback_type') required this.feedbackType, @JsonKey(name: 'id') required this.id, @JsonKey(name: 'tender') required this.tender, @JsonKey(name: 'updated_at') required this.updatedAt});
|
||||
factory _FeedbackData.fromJson(Map<String, dynamic> json) => _$FeedbackDataFromJson(json);
|
||||
|
||||
@override@JsonKey(name: 'company_id') final String? companyId;
|
||||
@override@JsonKey(name: 'created_at') final int? createdAt;
|
||||
@override@JsonKey(name: 'customer_id') final String? customerId;
|
||||
@override@JsonKey(name: 'feedback_type') final String? feedbackType;
|
||||
@override@JsonKey(name: 'id') final String? id;
|
||||
@override@JsonKey(name: 'tender') final String? tender;
|
||||
@override@JsonKey(name: 'updated_at') final int? updatedAt;
|
||||
|
||||
/// Create a copy of FeedbackData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$FeedbackDataCopyWith<_FeedbackData> get copyWith => __$FeedbackDataCopyWithImpl<_FeedbackData>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$FeedbackDataToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _FeedbackData&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.customerId, customerId) || other.customerId == customerId)&&(identical(other.feedbackType, feedbackType) || other.feedbackType == feedbackType)&&(identical(other.id, id) || other.id == id)&&(identical(other.tender, tender) || other.tender == tender)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,companyId,createdAt,customerId,feedbackType,id,tender,updatedAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'FeedbackData(companyId: $companyId, createdAt: $createdAt, customerId: $customerId, feedbackType: $feedbackType, id: $id, tender: $tender, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$FeedbackDataCopyWith<$Res> implements $FeedbackDataCopyWith<$Res> {
|
||||
factory _$FeedbackDataCopyWith(_FeedbackData value, $Res Function(_FeedbackData) _then) = __$FeedbackDataCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'company_id') String? companyId,@JsonKey(name: 'created_at') int? createdAt,@JsonKey(name: 'customer_id') String? customerId,@JsonKey(name: 'feedback_type') String? feedbackType,@JsonKey(name: 'id') String? id,@JsonKey(name: 'tender') String? tender,@JsonKey(name: 'updated_at') int? updatedAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$FeedbackDataCopyWithImpl<$Res>
|
||||
implements _$FeedbackDataCopyWith<$Res> {
|
||||
__$FeedbackDataCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _FeedbackData _self;
|
||||
final $Res Function(_FeedbackData) _then;
|
||||
|
||||
/// Create a copy of FeedbackData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? companyId = freezed,Object? createdAt = freezed,Object? customerId = freezed,Object? feedbackType = freezed,Object? id = freezed,Object? tender = freezed,Object? updatedAt = freezed,}) {
|
||||
return _then(_FeedbackData(
|
||||
companyId: freezed == companyId ? _self.companyId : companyId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int?,customerId: freezed == customerId ? _self.customerId : customerId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,feedbackType: freezed == feedbackType ? _self.feedbackType : feedbackType // ignore: cast_nullable_to_non_nullable
|
||||
as String?,id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,tender: freezed == tender ? _self.tender : tender // ignore: cast_nullable_to_non_nullable
|
||||
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,29 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'feedback_data.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_FeedbackData _$FeedbackDataFromJson(Map<String, dynamic> json) =>
|
||||
_FeedbackData(
|
||||
companyId: json['company_id'] as String?,
|
||||
createdAt: (json['created_at'] as num?)?.toInt(),
|
||||
customerId: json['customer_id'] as String?,
|
||||
feedbackType: json['feedback_type'] as String?,
|
||||
id: json['id'] as String?,
|
||||
tender: json['tender'] as String?,
|
||||
updatedAt: (json['updated_at'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$FeedbackDataToJson(_FeedbackData instance) =>
|
||||
<String, dynamic>{
|
||||
'company_id': instance.companyId,
|
||||
'created_at': instance.createdAt,
|
||||
'customer_id': instance.customerId,
|
||||
'feedback_type': instance.feedbackType,
|
||||
'id': instance.id,
|
||||
'tender': instance.tender,
|
||||
'updated_at': instance.updatedAt,
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
// ignore_for_file: invalid_annotation_target
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'feedback_request.freezed.dart';
|
||||
part 'feedback_request.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class FeedbackRequest with _$FeedbackRequest {
|
||||
const factory FeedbackRequest({
|
||||
@JsonKey(name: 'feedback_type') required String feedbackType,
|
||||
@JsonKey(name: 'tender_id') required String tenderId,
|
||||
}) = _FeedbackRequest;
|
||||
|
||||
factory FeedbackRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$FeedbackRequestFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,280 @@
|
||||
// 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 'feedback_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$FeedbackRequest {
|
||||
|
||||
@JsonKey(name: 'feedback_type') String get feedbackType;@JsonKey(name: 'tender_id') String get tenderId;
|
||||
/// Create a copy of FeedbackRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$FeedbackRequestCopyWith<FeedbackRequest> get copyWith => _$FeedbackRequestCopyWithImpl<FeedbackRequest>(this as FeedbackRequest, _$identity);
|
||||
|
||||
/// Serializes this FeedbackRequest to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is FeedbackRequest&&(identical(other.feedbackType, feedbackType) || other.feedbackType == feedbackType)&&(identical(other.tenderId, tenderId) || other.tenderId == tenderId));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,feedbackType,tenderId);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'FeedbackRequest(feedbackType: $feedbackType, tenderId: $tenderId)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $FeedbackRequestCopyWith<$Res> {
|
||||
factory $FeedbackRequestCopyWith(FeedbackRequest value, $Res Function(FeedbackRequest) _then) = _$FeedbackRequestCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'feedback_type') String feedbackType,@JsonKey(name: 'tender_id') String tenderId
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$FeedbackRequestCopyWithImpl<$Res>
|
||||
implements $FeedbackRequestCopyWith<$Res> {
|
||||
_$FeedbackRequestCopyWithImpl(this._self, this._then);
|
||||
|
||||
final FeedbackRequest _self;
|
||||
final $Res Function(FeedbackRequest) _then;
|
||||
|
||||
/// Create a copy of FeedbackRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? feedbackType = null,Object? tenderId = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
feedbackType: null == feedbackType ? _self.feedbackType : feedbackType // ignore: cast_nullable_to_non_nullable
|
||||
as String,tenderId: null == tenderId ? _self.tenderId : tenderId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [FeedbackRequest].
|
||||
extension FeedbackRequestPatterns on FeedbackRequest {
|
||||
/// 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( _FeedbackRequest value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackRequest() 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( _FeedbackRequest value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackRequest():
|
||||
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( _FeedbackRequest value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackRequest() 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(@JsonKey(name: 'feedback_type') String feedbackType, @JsonKey(name: 'tender_id') String tenderId)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackRequest() when $default != null:
|
||||
return $default(_that.feedbackType,_that.tenderId);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(@JsonKey(name: 'feedback_type') String feedbackType, @JsonKey(name: 'tender_id') String tenderId) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackRequest():
|
||||
return $default(_that.feedbackType,_that.tenderId);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(@JsonKey(name: 'feedback_type') String feedbackType, @JsonKey(name: 'tender_id') String tenderId)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackRequest() when $default != null:
|
||||
return $default(_that.feedbackType,_that.tenderId);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _FeedbackRequest implements FeedbackRequest {
|
||||
const _FeedbackRequest({@JsonKey(name: 'feedback_type') required this.feedbackType, @JsonKey(name: 'tender_id') required this.tenderId});
|
||||
factory _FeedbackRequest.fromJson(Map<String, dynamic> json) => _$FeedbackRequestFromJson(json);
|
||||
|
||||
@override@JsonKey(name: 'feedback_type') final String feedbackType;
|
||||
@override@JsonKey(name: 'tender_id') final String tenderId;
|
||||
|
||||
/// Create a copy of FeedbackRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$FeedbackRequestCopyWith<_FeedbackRequest> get copyWith => __$FeedbackRequestCopyWithImpl<_FeedbackRequest>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$FeedbackRequestToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _FeedbackRequest&&(identical(other.feedbackType, feedbackType) || other.feedbackType == feedbackType)&&(identical(other.tenderId, tenderId) || other.tenderId == tenderId));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,feedbackType,tenderId);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'FeedbackRequest(feedbackType: $feedbackType, tenderId: $tenderId)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$FeedbackRequestCopyWith<$Res> implements $FeedbackRequestCopyWith<$Res> {
|
||||
factory _$FeedbackRequestCopyWith(_FeedbackRequest value, $Res Function(_FeedbackRequest) _then) = __$FeedbackRequestCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'feedback_type') String feedbackType,@JsonKey(name: 'tender_id') String tenderId
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$FeedbackRequestCopyWithImpl<$Res>
|
||||
implements _$FeedbackRequestCopyWith<$Res> {
|
||||
__$FeedbackRequestCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _FeedbackRequest _self;
|
||||
final $Res Function(_FeedbackRequest) _then;
|
||||
|
||||
/// Create a copy of FeedbackRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? feedbackType = null,Object? tenderId = null,}) {
|
||||
return _then(_FeedbackRequest(
|
||||
feedbackType: null == feedbackType ? _self.feedbackType : feedbackType // ignore: cast_nullable_to_non_nullable
|
||||
as String,tenderId: null == tenderId ? _self.tenderId : tenderId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,19 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'feedback_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_FeedbackRequest _$FeedbackRequestFromJson(Map<String, dynamic> json) =>
|
||||
_FeedbackRequest(
|
||||
feedbackType: json['feedback_type'] as String,
|
||||
tenderId: json['tender_id'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$FeedbackRequestToJson(_FeedbackRequest instance) =>
|
||||
<String, dynamic>{
|
||||
'feedback_type': instance.feedbackType,
|
||||
'tender_id': instance.tenderId,
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
// ignore_for_file: invalid_annotation_target
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../error/error_model.dart';
|
||||
import '../feedback_data/feedback_data.dart';
|
||||
import '../meta/meta.dart';
|
||||
|
||||
part 'feedback_response.freezed.dart';
|
||||
part 'feedback_response.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class FeedbackResponse with _$FeedbackResponse {
|
||||
const factory FeedbackResponse({
|
||||
@JsonKey(name: 'meta') required Meta? meta,
|
||||
@JsonKey(name: 'data') required List<FeedbackData>? data,
|
||||
@JsonKey(name: 'error') required ErrorModel? error,
|
||||
required String? message,
|
||||
required bool? success,
|
||||
}) = _FeedbackResponse;
|
||||
|
||||
factory FeedbackResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$FeedbackResponseFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,345 @@
|
||||
// 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 'feedback_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$FeedbackResponse {
|
||||
|
||||
@JsonKey(name: 'meta') Meta? get meta;@JsonKey(name: 'data') List<FeedbackData>? get data;@JsonKey(name: 'error') ErrorModel? get error; String? get message; bool? get success;
|
||||
/// Create a copy of FeedbackResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$FeedbackResponseCopyWith<FeedbackResponse> get copyWith => _$FeedbackResponseCopyWithImpl<FeedbackResponse>(this as FeedbackResponse, _$identity);
|
||||
|
||||
/// Serializes this FeedbackResponse to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is FeedbackResponse&&(identical(other.meta, meta) || other.meta == meta)&&const DeepCollectionEquality().equals(other.data, data)&&(identical(other.error, error) || other.error == error)&&(identical(other.message, message) || other.message == message)&&(identical(other.success, success) || other.success == success));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,meta,const DeepCollectionEquality().hash(data),error,message,success);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'FeedbackResponse(meta: $meta, data: $data, error: $error, message: $message, success: $success)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $FeedbackResponseCopyWith<$Res> {
|
||||
factory $FeedbackResponseCopyWith(FeedbackResponse value, $Res Function(FeedbackResponse) _then) = _$FeedbackResponseCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'meta') Meta? meta,@JsonKey(name: 'data') List<FeedbackData>? data,@JsonKey(name: 'error') ErrorModel? error, String? message, bool? success
|
||||
});
|
||||
|
||||
|
||||
$MetaCopyWith<$Res>? get meta;$ErrorModelCopyWith<$Res>? get error;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$FeedbackResponseCopyWithImpl<$Res>
|
||||
implements $FeedbackResponseCopyWith<$Res> {
|
||||
_$FeedbackResponseCopyWithImpl(this._self, this._then);
|
||||
|
||||
final FeedbackResponse _self;
|
||||
final $Res Function(FeedbackResponse) _then;
|
||||
|
||||
/// Create a copy of FeedbackResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? meta = freezed,Object? data = freezed,Object? error = freezed,Object? message = freezed,Object? success = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
meta: freezed == meta ? _self.meta : meta // ignore: cast_nullable_to_non_nullable
|
||||
as Meta?,data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
|
||||
as List<FeedbackData>?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
|
||||
as ErrorModel?,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?,
|
||||
));
|
||||
}
|
||||
/// Create a copy of FeedbackResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$MetaCopyWith<$Res>? get meta {
|
||||
if (_self.meta == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $MetaCopyWith<$Res>(_self.meta!, (value) {
|
||||
return _then(_self.copyWith(meta: value));
|
||||
});
|
||||
}/// Create a copy of FeedbackResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ErrorModelCopyWith<$Res>? get error {
|
||||
if (_self.error == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
|
||||
return _then(_self.copyWith(error: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [FeedbackResponse].
|
||||
extension FeedbackResponsePatterns on FeedbackResponse {
|
||||
/// 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( _FeedbackResponse value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackResponse() 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( _FeedbackResponse value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackResponse():
|
||||
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( _FeedbackResponse value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackResponse() 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(@JsonKey(name: 'meta') Meta? meta, @JsonKey(name: 'data') List<FeedbackData>? data, @JsonKey(name: 'error') ErrorModel? error, String? message, bool? success)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackResponse() when $default != null:
|
||||
return $default(_that.meta,_that.data,_that.error,_that.message,_that.success);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(@JsonKey(name: 'meta') Meta? meta, @JsonKey(name: 'data') List<FeedbackData>? data, @JsonKey(name: 'error') ErrorModel? error, String? message, bool? success) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackResponse():
|
||||
return $default(_that.meta,_that.data,_that.error,_that.message,_that.success);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(@JsonKey(name: 'meta') Meta? meta, @JsonKey(name: 'data') List<FeedbackData>? data, @JsonKey(name: 'error') ErrorModel? error, String? message, bool? success)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FeedbackResponse() when $default != null:
|
||||
return $default(_that.meta,_that.data,_that.error,_that.message,_that.success);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _FeedbackResponse implements FeedbackResponse {
|
||||
const _FeedbackResponse({@JsonKey(name: 'meta') required this.meta, @JsonKey(name: 'data') required final List<FeedbackData>? data, @JsonKey(name: 'error') required this.error, required this.message, required this.success}): _data = data;
|
||||
factory _FeedbackResponse.fromJson(Map<String, dynamic> json) => _$FeedbackResponseFromJson(json);
|
||||
|
||||
@override@JsonKey(name: 'meta') final Meta? meta;
|
||||
final List<FeedbackData>? _data;
|
||||
@override@JsonKey(name: 'data') List<FeedbackData>? get data {
|
||||
final value = _data;
|
||||
if (value == null) return null;
|
||||
if (_data is EqualUnmodifiableListView) return _data;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
@override@JsonKey(name: 'error') final ErrorModel? error;
|
||||
@override final String? message;
|
||||
@override final bool? success;
|
||||
|
||||
/// Create a copy of FeedbackResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$FeedbackResponseCopyWith<_FeedbackResponse> get copyWith => __$FeedbackResponseCopyWithImpl<_FeedbackResponse>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$FeedbackResponseToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _FeedbackResponse&&(identical(other.meta, meta) || other.meta == meta)&&const DeepCollectionEquality().equals(other._data, _data)&&(identical(other.error, error) || other.error == error)&&(identical(other.message, message) || other.message == message)&&(identical(other.success, success) || other.success == success));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,meta,const DeepCollectionEquality().hash(_data),error,message,success);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'FeedbackResponse(meta: $meta, data: $data, error: $error, message: $message, success: $success)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$FeedbackResponseCopyWith<$Res> implements $FeedbackResponseCopyWith<$Res> {
|
||||
factory _$FeedbackResponseCopyWith(_FeedbackResponse value, $Res Function(_FeedbackResponse) _then) = __$FeedbackResponseCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'meta') Meta? meta,@JsonKey(name: 'data') List<FeedbackData>? data,@JsonKey(name: 'error') ErrorModel? error, String? message, bool? success
|
||||
});
|
||||
|
||||
|
||||
@override $MetaCopyWith<$Res>? get meta;@override $ErrorModelCopyWith<$Res>? get error;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$FeedbackResponseCopyWithImpl<$Res>
|
||||
implements _$FeedbackResponseCopyWith<$Res> {
|
||||
__$FeedbackResponseCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _FeedbackResponse _self;
|
||||
final $Res Function(_FeedbackResponse) _then;
|
||||
|
||||
/// Create a copy of FeedbackResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? meta = freezed,Object? data = freezed,Object? error = freezed,Object? message = freezed,Object? success = freezed,}) {
|
||||
return _then(_FeedbackResponse(
|
||||
meta: freezed == meta ? _self.meta : meta // ignore: cast_nullable_to_non_nullable
|
||||
as Meta?,data: freezed == data ? _self._data : data // ignore: cast_nullable_to_non_nullable
|
||||
as List<FeedbackData>?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
|
||||
as ErrorModel?,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?,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of FeedbackResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$MetaCopyWith<$Res>? get meta {
|
||||
if (_self.meta == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $MetaCopyWith<$Res>(_self.meta!, (value) {
|
||||
return _then(_self.copyWith(meta: value));
|
||||
});
|
||||
}/// Create a copy of FeedbackResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ErrorModelCopyWith<$Res>? get error {
|
||||
if (_self.error == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
|
||||
return _then(_self.copyWith(error: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,34 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'feedback_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_FeedbackResponse _$FeedbackResponseFromJson(Map<String, dynamic> json) =>
|
||||
_FeedbackResponse(
|
||||
meta:
|
||||
json['meta'] == null
|
||||
? null
|
||||
: Meta.fromJson(json['meta'] as Map<String, dynamic>),
|
||||
data:
|
||||
(json['data'] as List<dynamic>?)
|
||||
?.map((e) => FeedbackData.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
error:
|
||||
json['error'] == null
|
||||
? null
|
||||
: ErrorModel.fromJson(json['error'] as Map<String, dynamic>),
|
||||
message: json['message'] as String?,
|
||||
success: json['success'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$FeedbackResponseToJson(_FeedbackResponse instance) =>
|
||||
<String, dynamic>{
|
||||
'meta': instance.meta,
|
||||
'data': instance.data,
|
||||
'error': instance.error,
|
||||
'message': instance.message,
|
||||
'success': instance.success,
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
// ignore_for_file: invalid_annotation_target
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'meta.freezed.dart';
|
||||
part 'meta.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class Meta with _$Meta {
|
||||
const factory Meta({
|
||||
required int? limit,
|
||||
required int? offset,
|
||||
required int? page,
|
||||
required int? pages,
|
||||
required int? total,
|
||||
}) = _Meta;
|
||||
|
||||
factory Meta.fromJson(Map<String, dynamic> json) => _$MetaFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
// 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 'meta.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$Meta {
|
||||
|
||||
int? get limit; int? get offset; int? get page; int? get pages; int? get total;
|
||||
/// Create a copy of Meta
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$MetaCopyWith<Meta> get copyWith => _$MetaCopyWithImpl<Meta>(this as Meta, _$identity);
|
||||
|
||||
/// Serializes this Meta to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is Meta&&(identical(other.limit, limit) || other.limit == limit)&&(identical(other.offset, offset) || other.offset == offset)&&(identical(other.page, page) || other.page == page)&&(identical(other.pages, pages) || other.pages == pages)&&(identical(other.total, total) || other.total == total));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,limit,offset,page,pages,total);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Meta(limit: $limit, offset: $offset, page: $page, pages: $pages, total: $total)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $MetaCopyWith<$Res> {
|
||||
factory $MetaCopyWith(Meta value, $Res Function(Meta) _then) = _$MetaCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int? limit, int? offset, int? page, int? pages, int? total
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$MetaCopyWithImpl<$Res>
|
||||
implements $MetaCopyWith<$Res> {
|
||||
_$MetaCopyWithImpl(this._self, this._then);
|
||||
|
||||
final Meta _self;
|
||||
final $Res Function(Meta) _then;
|
||||
|
||||
/// Create a copy of Meta
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? limit = freezed,Object? offset = freezed,Object? page = freezed,Object? pages = freezed,Object? total = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
limit: freezed == limit ? _self.limit : limit // ignore: cast_nullable_to_non_nullable
|
||||
as int?,offset: freezed == offset ? _self.offset : offset // ignore: cast_nullable_to_non_nullable
|
||||
as int?,page: freezed == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||
as int?,pages: freezed == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||
as int?,total: freezed == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [Meta].
|
||||
extension MetaPatterns on Meta {
|
||||
/// 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( _Meta value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Meta() 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( _Meta value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Meta():
|
||||
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( _Meta value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Meta() 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( int? limit, int? offset, int? page, int? pages, int? total)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Meta() when $default != null:
|
||||
return $default(_that.limit,_that.offset,_that.page,_that.pages,_that.total);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( int? limit, int? offset, int? page, int? pages, int? total) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Meta():
|
||||
return $default(_that.limit,_that.offset,_that.page,_that.pages,_that.total);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( int? limit, int? offset, int? page, int? pages, int? total)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Meta() when $default != null:
|
||||
return $default(_that.limit,_that.offset,_that.page,_that.pages,_that.total);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _Meta implements Meta {
|
||||
const _Meta({required this.limit, required this.offset, required this.page, required this.pages, required this.total});
|
||||
factory _Meta.fromJson(Map<String, dynamic> json) => _$MetaFromJson(json);
|
||||
|
||||
@override final int? limit;
|
||||
@override final int? offset;
|
||||
@override final int? page;
|
||||
@override final int? pages;
|
||||
@override final int? total;
|
||||
|
||||
/// Create a copy of Meta
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$MetaCopyWith<_Meta> get copyWith => __$MetaCopyWithImpl<_Meta>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$MetaToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Meta&&(identical(other.limit, limit) || other.limit == limit)&&(identical(other.offset, offset) || other.offset == offset)&&(identical(other.page, page) || other.page == page)&&(identical(other.pages, pages) || other.pages == pages)&&(identical(other.total, total) || other.total == total));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,limit,offset,page,pages,total);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Meta(limit: $limit, offset: $offset, page: $page, pages: $pages, total: $total)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$MetaCopyWith<$Res> implements $MetaCopyWith<$Res> {
|
||||
factory _$MetaCopyWith(_Meta value, $Res Function(_Meta) _then) = __$MetaCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
int? limit, int? offset, int? page, int? pages, int? total
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$MetaCopyWithImpl<$Res>
|
||||
implements _$MetaCopyWith<$Res> {
|
||||
__$MetaCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Meta _self;
|
||||
final $Res Function(_Meta) _then;
|
||||
|
||||
/// Create a copy of Meta
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? limit = freezed,Object? offset = freezed,Object? page = freezed,Object? pages = freezed,Object? total = freezed,}) {
|
||||
return _then(_Meta(
|
||||
limit: freezed == limit ? _self.limit : limit // ignore: cast_nullable_to_non_nullable
|
||||
as int?,offset: freezed == offset ? _self.offset : offset // ignore: cast_nullable_to_non_nullable
|
||||
as int?,page: freezed == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||
as int?,pages: freezed == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||
as int?,total: freezed == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,23 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'meta.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_Meta _$MetaFromJson(Map<String, dynamic> json) => _Meta(
|
||||
limit: (json['limit'] as num?)?.toInt(),
|
||||
offset: (json['offset'] as num?)?.toInt(),
|
||||
page: (json['page'] as num?)?.toInt(),
|
||||
pages: (json['pages'] as num?)?.toInt(),
|
||||
total: (json['total'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$MetaToJson(_Meta instance) => <String, dynamic>{
|
||||
'limit': instance.limit,
|
||||
'offset': instance.offset,
|
||||
'page': instance.page,
|
||||
'pages': instance.pages,
|
||||
'total': instance.total,
|
||||
};
|
||||
@@ -4,6 +4,7 @@ import 'package:tm_app/data/services/model/profile_data/profile_data.dart';
|
||||
|
||||
import '../core/utils/result.dart';
|
||||
import '../data/repositories/profile_repository.dart';
|
||||
import '../data/services/model/logout_response/logout_response.dart';
|
||||
import '../data/services/model/profile_response/profile_response.dart';
|
||||
|
||||
class ProfileViewModel with ChangeNotifier {
|
||||
@@ -21,8 +22,10 @@ class ProfileViewModel with ChangeNotifier {
|
||||
bool _isLoading = false;
|
||||
String? _errorMessage;
|
||||
ProfileData? _profileData;
|
||||
bool _loggedOut = false;
|
||||
|
||||
bool get isLoading => _isLoading;
|
||||
bool get loggedOut => _loggedOut;
|
||||
String? get errorMessage => _errorMessage;
|
||||
ProfileData? get profileData => _profileData;
|
||||
|
||||
@@ -46,4 +49,26 @@ class ProfileViewModel with ChangeNotifier {
|
||||
_errorMessage = null;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> localLogout() async {
|
||||
await _authRepository.localLogout();
|
||||
_loggedOut = true;
|
||||
}
|
||||
|
||||
Future<void> logout() async {
|
||||
_errorMessage = null;
|
||||
notifyListeners();
|
||||
final result = await _authRepository.logout();
|
||||
switch (result) {
|
||||
case Ok<LogoutResponse>():
|
||||
await localLogout();
|
||||
break;
|
||||
case Error<LogoutResponse>():
|
||||
_errorMessage = result.error.toString();
|
||||
break;
|
||||
}
|
||||
|
||||
_errorMessage = null;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,59 +1,108 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/routes/app_routes.dart';
|
||||
import 'package:tm_app/view_models/profile_view_model.dart';
|
||||
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
import '../widgets/theme_toggle.dart';
|
||||
import '../widgets/title_description.dart';
|
||||
|
||||
class DesktopProfilePage extends StatelessWidget {
|
||||
class DesktopProfilePage extends StatefulWidget {
|
||||
const DesktopProfilePage({super.key});
|
||||
|
||||
@override
|
||||
State<DesktopProfilePage> createState() => _DesktopProfilePageState();
|
||||
}
|
||||
|
||||
class _DesktopProfilePageState extends State<DesktopProfilePage> {
|
||||
late ProfileViewModel viewModel;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
viewModel = context.read<ProfileViewModel>();
|
||||
viewModel.addListener(_profileListener);
|
||||
}
|
||||
|
||||
void _profileListener() {
|
||||
if (viewModel.errorMessage != null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(viewModel.errorMessage!),
|
||||
backgroundColor: AppColors.red,
|
||||
),
|
||||
);
|
||||
}
|
||||
if (viewModel.loggedOut) {
|
||||
LoginScreenRoute().go(context);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
viewModel.removeListener(_profileListener);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
body: Center(
|
||||
child: SizedBox(
|
||||
width: 740,
|
||||
height: 507,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 36.0.h()),
|
||||
TitleDescription(
|
||||
title: 'Company Name',
|
||||
description: 'Telecom Solutions GmbH',
|
||||
body: Consumer<ProfileViewModel>(
|
||||
builder: (context, viewModel, child) {
|
||||
if (viewModel.isLoading) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(color: AppColors.secondary50),
|
||||
);
|
||||
}
|
||||
if (viewModel.errorMessage != null) {
|
||||
return Center(child: Text(viewModel.errorMessage!));
|
||||
}
|
||||
|
||||
return Center(
|
||||
child: SizedBox(
|
||||
width: 740,
|
||||
height: 507,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 36.0.h()),
|
||||
TitleDescription(
|
||||
title: 'Company Name',
|
||||
description: 'Telecom Solutions GmbH',
|
||||
),
|
||||
TitleDescription(
|
||||
title: 'National ID',
|
||||
description: '12345678901',
|
||||
),
|
||||
TitleDescription(
|
||||
title: 'Registration No.',
|
||||
description: 'DE-55667788',
|
||||
),
|
||||
TitleDescription(
|
||||
title: 'Business Type',
|
||||
description: 'Telecommunications',
|
||||
),
|
||||
TitleDescription(title: 'Founded', description: '2010'),
|
||||
SizedBox(height: 24.0.h()),
|
||||
// Theme Toggle
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 16.0.w(),
|
||||
vertical: 12.0.h(),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surfaceColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColors.borderColor),
|
||||
),
|
||||
child: const ThemeToggle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
TitleDescription(
|
||||
title: 'National ID',
|
||||
description: '12345678901',
|
||||
),
|
||||
TitleDescription(
|
||||
title: 'Registration No.',
|
||||
description: 'DE-55667788',
|
||||
),
|
||||
TitleDescription(
|
||||
title: 'Business Type',
|
||||
description: 'Telecommunications',
|
||||
),
|
||||
TitleDescription(title: 'Founded', description: '2010'),
|
||||
SizedBox(height: 24.0.h()),
|
||||
// Theme Toggle
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 16.0.w(),
|
||||
vertical: 12.0.h(),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surfaceColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColors.borderColor),
|
||||
),
|
||||
child: const ThemeToggle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/view_models/auth_view_model.dart';
|
||||
import 'package:tm_app/core/routes/app_routes.dart';
|
||||
import 'package:tm_app/view_models/profile_view_model.dart';
|
||||
import 'package:tm_app/views/shared/tender_app_bar.dart';
|
||||
|
||||
@@ -10,9 +10,42 @@ import '../../../core/utils/size_config.dart';
|
||||
import '../widgets/theme_toggle.dart';
|
||||
import '../widgets/title_description.dart';
|
||||
|
||||
class MobileProfilePage extends StatelessWidget {
|
||||
class MobileProfilePage extends StatefulWidget {
|
||||
const MobileProfilePage({super.key});
|
||||
|
||||
@override
|
||||
State<MobileProfilePage> createState() => _MobileProfilePageState();
|
||||
}
|
||||
|
||||
class _MobileProfilePageState extends State<MobileProfilePage> {
|
||||
late ProfileViewModel viewModel;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
viewModel = context.read<ProfileViewModel>();
|
||||
viewModel.addListener(_profileListener);
|
||||
}
|
||||
|
||||
void _profileListener() {
|
||||
if (viewModel.errorMessage != null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(viewModel.errorMessage!),
|
||||
backgroundColor: AppColors.red,
|
||||
),
|
||||
);
|
||||
}
|
||||
if (viewModel.loggedOut) {
|
||||
LoginScreenRoute().go(context);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
viewModel.removeListener(_profileListener);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -70,9 +103,7 @@ class MobileProfilePage extends StatelessWidget {
|
||||
child: const ThemeToggle(),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.read<AuthViewModel>().logout();
|
||||
},
|
||||
onPressed: () => viewModel.logout(),
|
||||
child: const Text('Logout'),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,61 +1,110 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/routes/app_routes.dart';
|
||||
import 'package:tm_app/view_models/profile_view_model.dart';
|
||||
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
import '../widgets/theme_toggle.dart';
|
||||
import '../widgets/title_description.dart';
|
||||
|
||||
class TabletProfilePage extends StatelessWidget {
|
||||
class TabletProfilePage extends StatefulWidget {
|
||||
const TabletProfilePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
body: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 24.0.w(),
|
||||
vertical: 16.0.h(),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 128.0.h()),
|
||||
TitleDescription(
|
||||
title: 'Company Name',
|
||||
description: 'Telecom Solutions GmbH',
|
||||
),
|
||||
TitleDescription(
|
||||
title: 'National ID',
|
||||
description: '12345678901',
|
||||
),
|
||||
TitleDescription(
|
||||
title: 'Registration No.',
|
||||
description: 'DE-55667788',
|
||||
),
|
||||
TitleDescription(
|
||||
title: 'Business Type',
|
||||
description: 'Telecommunications',
|
||||
),
|
||||
TitleDescription(title: 'Founded', description: '2010'),
|
||||
SizedBox(height: 24.0.h()),
|
||||
// Theme Toggle
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 16.0.w(),
|
||||
vertical: 12.0.h(),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surfaceColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColors.borderColor),
|
||||
),
|
||||
child: const ThemeToggle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
State<TabletProfilePage> createState() => _TabletProfilePageState();
|
||||
}
|
||||
|
||||
class _TabletProfilePageState extends State<TabletProfilePage> {
|
||||
late ProfileViewModel viewModel;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
viewModel = context.read<ProfileViewModel>();
|
||||
viewModel.addListener(_profileListener);
|
||||
}
|
||||
|
||||
void _profileListener() {
|
||||
if (viewModel.errorMessage != null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(viewModel.errorMessage!),
|
||||
backgroundColor: AppColors.red,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (viewModel.loggedOut) {
|
||||
LoginScreenRoute().go(context);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
viewModel.removeListener(_profileListener);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<ProfileViewModel>(
|
||||
builder: (context, viewModel, child) {
|
||||
if (viewModel.isLoading) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(color: AppColors.secondary50),
|
||||
);
|
||||
}
|
||||
if (viewModel.errorMessage != null) {
|
||||
return Center(child: Text(viewModel.errorMessage!));
|
||||
}
|
||||
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
body: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 24.0.w(),
|
||||
vertical: 16.0.h(),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 128.0.h()),
|
||||
TitleDescription(
|
||||
title: 'Company Name',
|
||||
description: 'Telecom Solutions GmbH',
|
||||
),
|
||||
TitleDescription(
|
||||
title: 'National ID',
|
||||
description: '12345678901',
|
||||
),
|
||||
TitleDescription(
|
||||
title: 'Registration No.',
|
||||
description: 'DE-55667788',
|
||||
),
|
||||
TitleDescription(
|
||||
title: 'Business Type',
|
||||
description: 'Telecommunications',
|
||||
),
|
||||
TitleDescription(title: 'Founded', description: '2010'),
|
||||
SizedBox(height: 24.0.h()),
|
||||
// Theme Toggle
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 16.0.w(),
|
||||
vertical: 12.0.h(),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surfaceColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColors.borderColor),
|
||||
),
|
||||
child: const ThemeToggle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user