sign up fixes

This commit is contained in:
2026-01-20 11:48:32 +01:00
parent 80b0750f62
commit a202971ef7
23 changed files with 719 additions and 572 deletions

View File

@@ -1,7 +1,7 @@
import 'package:auth/src/core/data/models/get_me_response_model.dart';
import 'package:auth/src/core/data/models/sign_up_request_model.dart';
import 'package:auth/src/core/data/models/sign_up_response_model.dart';
import 'package:auth/src/core/data/models/two_fa_secret_response_model.dart';
import 'package:auth/src/features/sign_up/domain/entities/sign_up_request_entity.dart';
import 'package:auth/src/features/sign_up/domain/entities/two_fa_secret_entity.dart';
abstract class AuthRemoteDatasource {
Future<MeUserModel> getMe();
@@ -13,7 +13,7 @@ abstract class AuthRemoteDatasource {
Future<String> login({required String email, required String password});
Future<void> twoFALogin({required String token, required String code});
Future<String> signUp({required SignUpRequestEntity request});
Future<SignUpResponseModel> signUp({required SignUpRequestModel request});
Future<TwoFASecretResponseModel> generateTwoFASignUp({required String token});
Future<void> verifyTwoFACodeSignUp({

View File

@@ -5,7 +5,6 @@ import 'package:auth/src/core/data/models/sign_up_request_model.dart';
import 'package:auth/src/core/data/models/sign_up_response_model.dart';
import 'package:auth/src/core/data/models/two_fa_secret_response_model.dart';
import 'package:auth/src/features/sign_up/domain/entities/sign_up_request_entity.dart';
import 'package:auth/src/features/sign_up/domain/entities/two_fa_secret_entity.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
@@ -111,10 +110,11 @@ class AuthRemoteDatasourceImpl implements AuthRemoteDatasource {
}
@override
Future<String> signUp({required SignUpRequestEntity request}) async {
Future<SignUpResponseModel> signUp({
required SignUpRequestModel request,
}) async {
try {
final body = request.toModel().toJson();
debugPrint(body.toString());
final body = request.toJson();
debugPrint(const JsonEncoder.withIndent(' ').convert(body));
final response = await _repository.post<Map<String, dynamic>>(
@@ -133,12 +133,12 @@ class AuthRemoteDatasourceImpl implements AuthRemoteDatasource {
throw Exception('Sign up failed: isCreated=false');
}
final token = parsed.item.token.trim();
if (token.isEmpty) {
throw Exception('Sign up response has empty token');
final userId = parsed.item.userId.trim();
if (userId.isEmpty) {
throw Exception('Sign up response has empty userId');
}
return token;
return parsed;
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error in signUp');
}

View File

@@ -17,25 +17,15 @@ abstract class SignUpRequestModel with _$SignUpRequestModel {
required List<AddressModel> taxResidences,
required List<AddressModel> addresses,
required int bornAt,
required String userId,
required String placeOfBirth,
required String birthCountry,
// ignore: invalid_annotation_target
@JsonKey(name: 'document') required String documentNumber,
required String document,
required String documentType,
// ignore: invalid_annotation_target
@JsonKey(name: 'relationType') required String relationship,
required String relationType,
}) = _SignUpRequestModel;
factory SignUpRequestModel.fromJson(Map<String, dynamic> json) =>
_$SignUpRequestModelFromJson(json);
@override
@JsonKey(name: 'document')
String get documentNumber;
@override
@JsonKey(name: 'relationType')
String get relationship;
}
extension SignUpRequestModelMapper on SignUpRequestEntity {
@@ -51,11 +41,10 @@ extension SignUpRequestModelMapper on SignUpRequestEntity {
.toList(growable: false),
addresses: addresses.map((e) => e.toModel()).toList(growable: false),
bornAt: bornAt,
userId: userId,
placeOfBirth: placeOfBirth,
birthCountry: birthCountry,
documentNumber: documentNumber,
document: document,
documentType: documentType,
relationship: relationship,
relationType: relationType,
);
}

View File

@@ -15,9 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$SignUpRequestModel {
String get firstName; String get lastName; String get email; String get phone; String get language; String get password; List<AddressModel> get taxResidences; List<AddressModel> get addresses; int get bornAt; String get userId; String get placeOfBirth; String get birthCountry;// ignore: invalid_annotation_target
@JsonKey(name: 'document') String get documentNumber; String get documentType;// ignore: invalid_annotation_target
@JsonKey(name: 'relationType') String get relationship;
String get firstName; String get lastName; String get email; String get phone; String get language; String get password; List<AddressModel> get taxResidences; List<AddressModel> get addresses; int get bornAt; String get placeOfBirth; String get birthCountry; String get document; String get documentType; String get relationType;
/// Create a copy of SignUpRequestModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -30,16 +28,16 @@ $SignUpRequestModelCopyWith<SignUpRequestModel> get copyWith => _$SignUpRequestM
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SignUpRequestModel&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password)&&const DeepCollectionEquality().equals(other.taxResidences, taxResidences)&&const DeepCollectionEquality().equals(other.addresses, addresses)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.documentNumber, documentNumber) || other.documentNumber == documentNumber)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.relationship, relationship) || other.relationship == relationship));
return identical(this, other) || (other.runtimeType == runtimeType&&other is SignUpRequestModel&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password)&&const DeepCollectionEquality().equals(other.taxResidences, taxResidences)&&const DeepCollectionEquality().equals(other.addresses, addresses)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.document, document) || other.document == document)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.relationType, relationType) || other.relationType == relationType));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,firstName,lastName,email,phone,language,password,const DeepCollectionEquality().hash(taxResidences),const DeepCollectionEquality().hash(addresses),bornAt,userId,placeOfBirth,birthCountry,documentNumber,documentType,relationship);
int get hashCode => Object.hash(runtimeType,firstName,lastName,email,phone,language,password,const DeepCollectionEquality().hash(taxResidences),const DeepCollectionEquality().hash(addresses),bornAt,placeOfBirth,birthCountry,document,documentType,relationType);
@override
String toString() {
return 'SignUpRequestModel(firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, userId: $userId, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, documentNumber: $documentNumber, documentType: $documentType, relationship: $relationship)';
return 'SignUpRequestModel(firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, document: $document, documentType: $documentType, relationType: $relationType)';
}
@@ -50,7 +48,7 @@ abstract mixin class $SignUpRequestModelCopyWith<$Res> {
factory $SignUpRequestModelCopyWith(SignUpRequestModel value, $Res Function(SignUpRequestModel) _then) = _$SignUpRequestModelCopyWithImpl;
@useResult
$Res call({
String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry,@JsonKey(name: 'document') String documentNumber, String documentType,@JsonKey(name: 'relationType') String relationship
String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String placeOfBirth, String birthCountry, String document, String documentType, String relationType
});
@@ -67,7 +65,7 @@ class _$SignUpRequestModelCopyWithImpl<$Res>
/// Create a copy of SignUpRequestModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,Object? taxResidences = null,Object? addresses = null,Object? bornAt = null,Object? userId = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? documentNumber = null,Object? documentType = null,Object? relationship = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,Object? taxResidences = null,Object? addresses = null,Object? bornAt = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? document = null,Object? documentType = null,Object? relationType = null,}) {
return _then(_self.copyWith(
firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
@@ -78,12 +76,11 @@ as String,password: null == password ? _self.password : password // ignore: cast
as String,taxResidences: null == taxResidences ? _self.taxResidences : taxResidences // ignore: cast_nullable_to_non_nullable
as List<AddressModel>,addresses: null == addresses ? _self.addresses : addresses // ignore: cast_nullable_to_non_nullable
as List<AddressModel>,bornAt: null == bornAt ? _self.bornAt : bornAt // ignore: cast_nullable_to_non_nullable
as int,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as String,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
as int,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
as String,birthCountry: null == birthCountry ? _self.birthCountry : birthCountry // ignore: cast_nullable_to_non_nullable
as String,documentNumber: null == documentNumber ? _self.documentNumber : documentNumber // ignore: cast_nullable_to_non_nullable
as String,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
as String,documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
as String,relationship: null == relationship ? _self.relationship : relationship // ignore: cast_nullable_to_non_nullable
as String,relationType: null == relationType ? _self.relationType : relationType // ignore: cast_nullable_to_non_nullable
as String,
));
}
@@ -169,10 +166,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry, @JsonKey(name: 'document') String documentNumber, String documentType, @JsonKey(name: 'relationType') String relationship)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String placeOfBirth, String birthCountry, String document, String documentType, String relationType)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _SignUpRequestModel() when $default != null:
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.documentNumber,_that.documentType,_that.relationship);case _:
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.placeOfBirth,_that.birthCountry,_that.document,_that.documentType,_that.relationType);case _:
return orElse();
}
@@ -190,10 +187,10 @@ return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.lan
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry, @JsonKey(name: 'document') String documentNumber, String documentType, @JsonKey(name: 'relationType') String relationship) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String placeOfBirth, String birthCountry, String document, String documentType, String relationType) $default,) {final _that = this;
switch (_that) {
case _SignUpRequestModel():
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.documentNumber,_that.documentType,_that.relationship);case _:
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.placeOfBirth,_that.birthCountry,_that.document,_that.documentType,_that.relationType);case _:
throw StateError('Unexpected subclass');
}
@@ -210,10 +207,10 @@ return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.lan
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry, @JsonKey(name: 'document') String documentNumber, String documentType, @JsonKey(name: 'relationType') String relationship)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String placeOfBirth, String birthCountry, String document, String documentType, String relationType)? $default,) {final _that = this;
switch (_that) {
case _SignUpRequestModel() when $default != null:
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.documentNumber,_that.documentType,_that.relationship);case _:
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.placeOfBirth,_that.birthCountry,_that.document,_that.documentType,_that.relationType);case _:
return null;
}
@@ -225,7 +222,7 @@ return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.lan
@JsonSerializable()
class _SignUpRequestModel implements SignUpRequestModel {
const _SignUpRequestModel({required this.firstName, required this.lastName, required this.email, required this.phone, required this.language, required this.password, required final List<AddressModel> taxResidences, required final List<AddressModel> addresses, required this.bornAt, required this.userId, required this.placeOfBirth, required this.birthCountry, @JsonKey(name: 'document') required this.documentNumber, required this.documentType, @JsonKey(name: 'relationType') required this.relationship}): _taxResidences = taxResidences,_addresses = addresses;
const _SignUpRequestModel({required this.firstName, required this.lastName, required this.email, required this.phone, required this.language, required this.password, required final List<AddressModel> taxResidences, required final List<AddressModel> addresses, required this.bornAt, required this.placeOfBirth, required this.birthCountry, required this.document, required this.documentType, required this.relationType}): _taxResidences = taxResidences,_addresses = addresses;
factory _SignUpRequestModel.fromJson(Map<String, dynamic> json) => _$SignUpRequestModelFromJson(json);
@override final String firstName;
@@ -249,14 +246,11 @@ class _SignUpRequestModel implements SignUpRequestModel {
}
@override final int bornAt;
@override final String userId;
@override final String placeOfBirth;
@override final String birthCountry;
// ignore: invalid_annotation_target
@override@JsonKey(name: 'document') final String documentNumber;
@override final String document;
@override final String documentType;
// ignore: invalid_annotation_target
@override@JsonKey(name: 'relationType') final String relationship;
@override final String relationType;
/// Create a copy of SignUpRequestModel
/// with the given fields replaced by the non-null parameter values.
@@ -271,16 +265,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SignUpRequestModel&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password)&&const DeepCollectionEquality().equals(other._taxResidences, _taxResidences)&&const DeepCollectionEquality().equals(other._addresses, _addresses)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.documentNumber, documentNumber) || other.documentNumber == documentNumber)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.relationship, relationship) || other.relationship == relationship));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SignUpRequestModel&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password)&&const DeepCollectionEquality().equals(other._taxResidences, _taxResidences)&&const DeepCollectionEquality().equals(other._addresses, _addresses)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.document, document) || other.document == document)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.relationType, relationType) || other.relationType == relationType));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,firstName,lastName,email,phone,language,password,const DeepCollectionEquality().hash(_taxResidences),const DeepCollectionEquality().hash(_addresses),bornAt,userId,placeOfBirth,birthCountry,documentNumber,documentType,relationship);
int get hashCode => Object.hash(runtimeType,firstName,lastName,email,phone,language,password,const DeepCollectionEquality().hash(_taxResidences),const DeepCollectionEquality().hash(_addresses),bornAt,placeOfBirth,birthCountry,document,documentType,relationType);
@override
String toString() {
return 'SignUpRequestModel(firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, userId: $userId, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, documentNumber: $documentNumber, documentType: $documentType, relationship: $relationship)';
return 'SignUpRequestModel(firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, document: $document, documentType: $documentType, relationType: $relationType)';
}
@@ -291,7 +285,7 @@ abstract mixin class _$SignUpRequestModelCopyWith<$Res> implements $SignUpReques
factory _$SignUpRequestModelCopyWith(_SignUpRequestModel value, $Res Function(_SignUpRequestModel) _then) = __$SignUpRequestModelCopyWithImpl;
@override @useResult
$Res call({
String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry,@JsonKey(name: 'document') String documentNumber, String documentType,@JsonKey(name: 'relationType') String relationship
String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String placeOfBirth, String birthCountry, String document, String documentType, String relationType
});
@@ -308,7 +302,7 @@ class __$SignUpRequestModelCopyWithImpl<$Res>
/// Create a copy of SignUpRequestModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,Object? taxResidences = null,Object? addresses = null,Object? bornAt = null,Object? userId = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? documentNumber = null,Object? documentType = null,Object? relationship = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,Object? taxResidences = null,Object? addresses = null,Object? bornAt = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? document = null,Object? documentType = null,Object? relationType = null,}) {
return _then(_SignUpRequestModel(
firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
@@ -319,12 +313,11 @@ as String,password: null == password ? _self.password : password // ignore: cast
as String,taxResidences: null == taxResidences ? _self._taxResidences : taxResidences // ignore: cast_nullable_to_non_nullable
as List<AddressModel>,addresses: null == addresses ? _self._addresses : addresses // ignore: cast_nullable_to_non_nullable
as List<AddressModel>,bornAt: null == bornAt ? _self.bornAt : bornAt // ignore: cast_nullable_to_non_nullable
as int,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as String,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
as int,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
as String,birthCountry: null == birthCountry ? _self.birthCountry : birthCountry // ignore: cast_nullable_to_non_nullable
as String,documentNumber: null == documentNumber ? _self.documentNumber : documentNumber // ignore: cast_nullable_to_non_nullable
as String,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
as String,documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
as String,relationship: null == relationship ? _self.relationship : relationship // ignore: cast_nullable_to_non_nullable
as String,relationType: null == relationType ? _self.relationType : relationType // ignore: cast_nullable_to_non_nullable
as String,
));
}

View File

@@ -21,12 +21,11 @@ _SignUpRequestModel _$SignUpRequestModelFromJson(Map<String, dynamic> json) =>
.map((e) => AddressModel.fromJson(e as Map<String, dynamic>))
.toList(),
bornAt: (json['bornAt'] as num).toInt(),
userId: json['userId'] as String,
placeOfBirth: json['placeOfBirth'] as String,
birthCountry: json['birthCountry'] as String,
documentNumber: json['document'] as String,
document: json['document'] as String,
documentType: json['documentType'] as String,
relationship: json['relationType'] as String,
relationType: json['relationType'] as String,
);
Map<String, dynamic> _$SignUpRequestModelToJson(_SignUpRequestModel instance) =>
@@ -40,10 +39,9 @@ Map<String, dynamic> _$SignUpRequestModelToJson(_SignUpRequestModel instance) =>
'taxResidences': instance.taxResidences,
'addresses': instance.addresses,
'bornAt': instance.bornAt,
'userId': instance.userId,
'placeOfBirth': instance.placeOfBirth,
'birthCountry': instance.birthCountry,
'document': instance.documentNumber,
'document': instance.document,
'documentType': instance.documentType,
'relationType': instance.relationship,
'relationType': instance.relationType,
};

View File

@@ -1,3 +1,4 @@
import 'package:auth/src/features/sign_up/domain/entities/sign_up_response_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'sign_up_response_model.freezed.dart';
@@ -16,9 +17,14 @@ abstract class SignUpResponseModel with _$SignUpResponseModel {
@freezed
abstract class SignUpResponseItemModel with _$SignUpResponseItemModel {
const factory SignUpResponseItemModel({required String token}) =
const factory SignUpResponseItemModel({required String userId}) =
_SignUpResponseItemModel;
factory SignUpResponseItemModel.fromJson(Map<String, dynamic> json) =>
_$SignUpResponseItemModelFromJson(json);
}
extension SignUpResponseModelMapper on SignUpResponseModel {
SignUpResponseEntity toEntity() =>
SignUpResponseEntity(isCreated: isCreated, userId: item.userId);
}

View File

@@ -299,7 +299,7 @@ $SignUpResponseItemModelCopyWith<$Res> get item {
/// @nodoc
mixin _$SignUpResponseItemModel {
String get token;
String get userId;
/// Create a copy of SignUpResponseItemModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -312,16 +312,16 @@ $SignUpResponseItemModelCopyWith<SignUpResponseItemModel> get copyWith => _$Sign
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SignUpResponseItemModel&&(identical(other.token, token) || other.token == token));
return identical(this, other) || (other.runtimeType == runtimeType&&other is SignUpResponseItemModel&&(identical(other.userId, userId) || other.userId == userId));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,token);
int get hashCode => Object.hash(runtimeType,userId);
@override
String toString() {
return 'SignUpResponseItemModel(token: $token)';
return 'SignUpResponseItemModel(userId: $userId)';
}
@@ -332,7 +332,7 @@ abstract mixin class $SignUpResponseItemModelCopyWith<$Res> {
factory $SignUpResponseItemModelCopyWith(SignUpResponseItemModel value, $Res Function(SignUpResponseItemModel) _then) = _$SignUpResponseItemModelCopyWithImpl;
@useResult
$Res call({
String token
String userId
});
@@ -349,9 +349,9 @@ class _$SignUpResponseItemModelCopyWithImpl<$Res>
/// Create a copy of SignUpResponseItemModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? token = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? userId = null,}) {
return _then(_self.copyWith(
token: null == token ? _self.token : token // ignore: cast_nullable_to_non_nullable
userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as String,
));
}
@@ -437,10 +437,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String token)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String userId)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _SignUpResponseItemModel() when $default != null:
return $default(_that.token);case _:
return $default(_that.userId);case _:
return orElse();
}
@@ -458,10 +458,10 @@ return $default(_that.token);case _:
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String token) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String userId) $default,) {final _that = this;
switch (_that) {
case _SignUpResponseItemModel():
return $default(_that.token);case _:
return $default(_that.userId);case _:
throw StateError('Unexpected subclass');
}
@@ -478,10 +478,10 @@ return $default(_that.token);case _:
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String token)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String userId)? $default,) {final _that = this;
switch (_that) {
case _SignUpResponseItemModel() when $default != null:
return $default(_that.token);case _:
return $default(_that.userId);case _:
return null;
}
@@ -493,10 +493,10 @@ return $default(_that.token);case _:
@JsonSerializable()
class _SignUpResponseItemModel implements SignUpResponseItemModel {
const _SignUpResponseItemModel({required this.token});
const _SignUpResponseItemModel({required this.userId});
factory _SignUpResponseItemModel.fromJson(Map<String, dynamic> json) => _$SignUpResponseItemModelFromJson(json);
@override final String token;
@override final String userId;
/// Create a copy of SignUpResponseItemModel
/// with the given fields replaced by the non-null parameter values.
@@ -511,16 +511,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SignUpResponseItemModel&&(identical(other.token, token) || other.token == token));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SignUpResponseItemModel&&(identical(other.userId, userId) || other.userId == userId));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,token);
int get hashCode => Object.hash(runtimeType,userId);
@override
String toString() {
return 'SignUpResponseItemModel(token: $token)';
return 'SignUpResponseItemModel(userId: $userId)';
}
@@ -531,7 +531,7 @@ abstract mixin class _$SignUpResponseItemModelCopyWith<$Res> implements $SignUpR
factory _$SignUpResponseItemModelCopyWith(_SignUpResponseItemModel value, $Res Function(_SignUpResponseItemModel) _then) = __$SignUpResponseItemModelCopyWithImpl;
@override @useResult
$Res call({
String token
String userId
});
@@ -548,9 +548,9 @@ class __$SignUpResponseItemModelCopyWithImpl<$Res>
/// Create a copy of SignUpResponseItemModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? token = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? userId = null,}) {
return _then(_SignUpResponseItemModel(
token: null == token ? _self.token : token // ignore: cast_nullable_to_non_nullable
userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as String,
));
}

View File

@@ -20,8 +20,8 @@ Map<String, dynamic> _$SignUpResponseModelToJson(
_SignUpResponseItemModel _$SignUpResponseItemModelFromJson(
Map<String, dynamic> json,
) => _SignUpResponseItemModel(token: json['token'] as String);
) => _SignUpResponseItemModel(userId: json['userId'] as String);
Map<String, dynamic> _$SignUpResponseItemModelToJson(
_SignUpResponseItemModel instance,
) => <String, dynamic>{'token': instance.token};
) => <String, dynamic>{'userId': instance.userId};

View File

@@ -1,7 +1,10 @@
import 'package:auth/src/core/data/datasource/auth_remote_datasource.dart';
import 'package:auth/src/core/data/models/sign_up_request_model.dart';
import 'package:auth/src/core/data/models/sign_up_response_model.dart';
import 'package:auth/src/core/data/models/two_fa_secret_response_model.dart';
import 'package:auth/src/core/domain/repositories/auth_repository.dart';
import 'package:auth/src/features/sign_up/domain/entities/sign_up_request_entity.dart';
import 'package:auth/src/features/sign_up/domain/entities/sign_up_response_entity.dart';
import 'package:auth/src/features/sign_up/domain/entities/two_fa_secret_entity.dart';
class AuthRepositoryImpl implements AuthRepository {
@@ -30,8 +33,13 @@ class AuthRepositoryImpl implements AuthRepository {
}
@override
Future<String> signUp({required SignUpRequestEntity request}) {
return _remote.signUp(request: request);
Future<SignUpResponseEntity> signUp({
required SignUpRequestEntity request,
}) async {
final model = request.toModel();
final responseModel = await _remote.signUp(request: model);
return responseModel.toEntity();
}
@override

View File

@@ -1,6 +1,6 @@
import 'package:auth/src/core/data/models/two_fa_secret_response_model.dart';
import 'package:auth/src/features/sign_up/domain/entities/sign_up_request_entity.dart';
import 'package:auth/src/features/sign_up/domain/entities/two_fa_secret_entity.dart';
import 'package:auth/src/features/sign_up/domain/entities/sign_up_response_entity.dart';
abstract class AuthRepository {
Future<void> requestPhoneCode({required String phone});
@@ -17,7 +17,7 @@ abstract class AuthRepository {
required String token,
});
Future<String> signUp({required SignUpRequestEntity request});
Future<SignUpResponseEntity> signUp({required SignUpRequestEntity request});
Future<TwoFASecretResponseModel> generateTwoFASignUp({required String token});
Future<void> verifyTwoFACodeSignUp({

View File

@@ -7,8 +7,8 @@ part 'sign_up_request_entity.freezed.dart';
abstract class SignUpRequestEntity with _$SignUpRequestEntity {
const factory SignUpRequestEntity({
required String documentType,
required String documentNumber,
required String relationship,
required String document,
required String relationType,
required String firstName,
required String lastName,
required String email,
@@ -18,7 +18,6 @@ abstract class SignUpRequestEntity with _$SignUpRequestEntity {
required List<AddressEntity> taxResidences,
required List<AddressEntity> addresses,
required int bornAt,
required String userId, // UUID
required String placeOfBirth,
required String birthCountry,
}) = _SignUpRequestEntity;

View File

@@ -14,8 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$SignUpRequestEntity {
String get documentType; String get documentNumber; String get relationship; String get firstName; String get lastName; String get email; String get phone; String get language; String get password; List<AddressEntity> get taxResidences; List<AddressEntity> get addresses; int get bornAt; String get userId;// UUID
String get placeOfBirth; String get birthCountry;
String get documentType; String get document; String get relationType; String get firstName; String get lastName; String get email; String get phone; String get language; String get password; List<AddressEntity> get taxResidences; List<AddressEntity> get addresses; int get bornAt; String get placeOfBirth; String get birthCountry;
/// Create a copy of SignUpRequestEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -26,16 +25,16 @@ $SignUpRequestEntityCopyWith<SignUpRequestEntity> get copyWith => _$SignUpReques
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SignUpRequestEntity&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.documentNumber, documentNumber) || other.documentNumber == documentNumber)&&(identical(other.relationship, relationship) || other.relationship == relationship)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password)&&const DeepCollectionEquality().equals(other.taxResidences, taxResidences)&&const DeepCollectionEquality().equals(other.addresses, addresses)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry));
return identical(this, other) || (other.runtimeType == runtimeType&&other is SignUpRequestEntity&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.document, document) || other.document == document)&&(identical(other.relationType, relationType) || other.relationType == relationType)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password)&&const DeepCollectionEquality().equals(other.taxResidences, taxResidences)&&const DeepCollectionEquality().equals(other.addresses, addresses)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry));
}
@override
int get hashCode => Object.hash(runtimeType,documentType,documentNumber,relationship,firstName,lastName,email,phone,language,password,const DeepCollectionEquality().hash(taxResidences),const DeepCollectionEquality().hash(addresses),bornAt,userId,placeOfBirth,birthCountry);
int get hashCode => Object.hash(runtimeType,documentType,document,relationType,firstName,lastName,email,phone,language,password,const DeepCollectionEquality().hash(taxResidences),const DeepCollectionEquality().hash(addresses),bornAt,placeOfBirth,birthCountry);
@override
String toString() {
return 'SignUpRequestEntity(documentType: $documentType, documentNumber: $documentNumber, relationship: $relationship, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, userId: $userId, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry)';
return 'SignUpRequestEntity(documentType: $documentType, document: $document, relationType: $relationType, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry)';
}
@@ -46,7 +45,7 @@ abstract mixin class $SignUpRequestEntityCopyWith<$Res> {
factory $SignUpRequestEntityCopyWith(SignUpRequestEntity value, $Res Function(SignUpRequestEntity) _then) = _$SignUpRequestEntityCopyWithImpl;
@useResult
$Res call({
String documentType, String documentNumber, String relationship, String firstName, String lastName, String email, String phone, String language, String password, List<AddressEntity> taxResidences, List<AddressEntity> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry
String documentType, String document, String relationType, String firstName, String lastName, String email, String phone, String language, String password, List<AddressEntity> taxResidences, List<AddressEntity> addresses, int bornAt, String placeOfBirth, String birthCountry
});
@@ -63,11 +62,11 @@ class _$SignUpRequestEntityCopyWithImpl<$Res>
/// Create a copy of SignUpRequestEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? documentType = null,Object? documentNumber = null,Object? relationship = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,Object? taxResidences = null,Object? addresses = null,Object? bornAt = null,Object? userId = null,Object? placeOfBirth = null,Object? birthCountry = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? documentType = null,Object? document = null,Object? relationType = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,Object? taxResidences = null,Object? addresses = null,Object? bornAt = null,Object? placeOfBirth = null,Object? birthCountry = null,}) {
return _then(_self.copyWith(
documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
as String,documentNumber: null == documentNumber ? _self.documentNumber : documentNumber // ignore: cast_nullable_to_non_nullable
as String,relationship: null == relationship ? _self.relationship : relationship // ignore: cast_nullable_to_non_nullable
as String,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
as String,relationType: null == relationType ? _self.relationType : relationType // ignore: cast_nullable_to_non_nullable
as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
@@ -77,8 +76,7 @@ as String,password: null == password ? _self.password : password // ignore: cast
as String,taxResidences: null == taxResidences ? _self.taxResidences : taxResidences // ignore: cast_nullable_to_non_nullable
as List<AddressEntity>,addresses: null == addresses ? _self.addresses : addresses // ignore: cast_nullable_to_non_nullable
as List<AddressEntity>,bornAt: null == bornAt ? _self.bornAt : bornAt // ignore: cast_nullable_to_non_nullable
as int,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as String,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
as int,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
as String,birthCountry: null == birthCountry ? _self.birthCountry : birthCountry // ignore: cast_nullable_to_non_nullable
as String,
));
@@ -165,10 +163,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String documentType, String documentNumber, String relationship, String firstName, String lastName, String email, String phone, String language, String password, List<AddressEntity> taxResidences, List<AddressEntity> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String documentType, String document, String relationType, String firstName, String lastName, String email, String phone, String language, String password, List<AddressEntity> taxResidences, List<AddressEntity> addresses, int bornAt, String placeOfBirth, String birthCountry)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _SignUpRequestEntity() when $default != null:
return $default(_that.documentType,_that.documentNumber,_that.relationship,_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.userId,_that.placeOfBirth,_that.birthCountry);case _:
return $default(_that.documentType,_that.document,_that.relationType,_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.placeOfBirth,_that.birthCountry);case _:
return orElse();
}
@@ -186,10 +184,10 @@ return $default(_that.documentType,_that.documentNumber,_that.relationship,_that
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String documentType, String documentNumber, String relationship, String firstName, String lastName, String email, String phone, String language, String password, List<AddressEntity> taxResidences, List<AddressEntity> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String documentType, String document, String relationType, String firstName, String lastName, String email, String phone, String language, String password, List<AddressEntity> taxResidences, List<AddressEntity> addresses, int bornAt, String placeOfBirth, String birthCountry) $default,) {final _that = this;
switch (_that) {
case _SignUpRequestEntity():
return $default(_that.documentType,_that.documentNumber,_that.relationship,_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.userId,_that.placeOfBirth,_that.birthCountry);case _:
return $default(_that.documentType,_that.document,_that.relationType,_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.placeOfBirth,_that.birthCountry);case _:
throw StateError('Unexpected subclass');
}
@@ -206,10 +204,10 @@ return $default(_that.documentType,_that.documentNumber,_that.relationship,_that
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String documentType, String documentNumber, String relationship, String firstName, String lastName, String email, String phone, String language, String password, List<AddressEntity> taxResidences, List<AddressEntity> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String documentType, String document, String relationType, String firstName, String lastName, String email, String phone, String language, String password, List<AddressEntity> taxResidences, List<AddressEntity> addresses, int bornAt, String placeOfBirth, String birthCountry)? $default,) {final _that = this;
switch (_that) {
case _SignUpRequestEntity() when $default != null:
return $default(_that.documentType,_that.documentNumber,_that.relationship,_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.userId,_that.placeOfBirth,_that.birthCountry);case _:
return $default(_that.documentType,_that.document,_that.relationType,_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.placeOfBirth,_that.birthCountry);case _:
return null;
}
@@ -221,12 +219,12 @@ return $default(_that.documentType,_that.documentNumber,_that.relationship,_that
class _SignUpRequestEntity implements SignUpRequestEntity {
const _SignUpRequestEntity({required this.documentType, required this.documentNumber, required this.relationship, required this.firstName, required this.lastName, required this.email, required this.phone, required this.language, required this.password, required final List<AddressEntity> taxResidences, required final List<AddressEntity> addresses, required this.bornAt, required this.userId, required this.placeOfBirth, required this.birthCountry}): _taxResidences = taxResidences,_addresses = addresses;
const _SignUpRequestEntity({required this.documentType, required this.document, required this.relationType, required this.firstName, required this.lastName, required this.email, required this.phone, required this.language, required this.password, required final List<AddressEntity> taxResidences, required final List<AddressEntity> addresses, required this.bornAt, required this.placeOfBirth, required this.birthCountry}): _taxResidences = taxResidences,_addresses = addresses;
@override final String documentType;
@override final String documentNumber;
@override final String relationship;
@override final String document;
@override final String relationType;
@override final String firstName;
@override final String lastName;
@override final String email;
@@ -248,8 +246,6 @@ class _SignUpRequestEntity implements SignUpRequestEntity {
}
@override final int bornAt;
@override final String userId;
// UUID
@override final String placeOfBirth;
@override final String birthCountry;
@@ -263,16 +259,16 @@ _$SignUpRequestEntityCopyWith<_SignUpRequestEntity> get copyWith => __$SignUpReq
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SignUpRequestEntity&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.documentNumber, documentNumber) || other.documentNumber == documentNumber)&&(identical(other.relationship, relationship) || other.relationship == relationship)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password)&&const DeepCollectionEquality().equals(other._taxResidences, _taxResidences)&&const DeepCollectionEquality().equals(other._addresses, _addresses)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SignUpRequestEntity&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.document, document) || other.document == document)&&(identical(other.relationType, relationType) || other.relationType == relationType)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password)&&const DeepCollectionEquality().equals(other._taxResidences, _taxResidences)&&const DeepCollectionEquality().equals(other._addresses, _addresses)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry));
}
@override
int get hashCode => Object.hash(runtimeType,documentType,documentNumber,relationship,firstName,lastName,email,phone,language,password,const DeepCollectionEquality().hash(_taxResidences),const DeepCollectionEquality().hash(_addresses),bornAt,userId,placeOfBirth,birthCountry);
int get hashCode => Object.hash(runtimeType,documentType,document,relationType,firstName,lastName,email,phone,language,password,const DeepCollectionEquality().hash(_taxResidences),const DeepCollectionEquality().hash(_addresses),bornAt,placeOfBirth,birthCountry);
@override
String toString() {
return 'SignUpRequestEntity(documentType: $documentType, documentNumber: $documentNumber, relationship: $relationship, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, userId: $userId, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry)';
return 'SignUpRequestEntity(documentType: $documentType, document: $document, relationType: $relationType, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry)';
}
@@ -283,7 +279,7 @@ abstract mixin class _$SignUpRequestEntityCopyWith<$Res> implements $SignUpReque
factory _$SignUpRequestEntityCopyWith(_SignUpRequestEntity value, $Res Function(_SignUpRequestEntity) _then) = __$SignUpRequestEntityCopyWithImpl;
@override @useResult
$Res call({
String documentType, String documentNumber, String relationship, String firstName, String lastName, String email, String phone, String language, String password, List<AddressEntity> taxResidences, List<AddressEntity> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry
String documentType, String document, String relationType, String firstName, String lastName, String email, String phone, String language, String password, List<AddressEntity> taxResidences, List<AddressEntity> addresses, int bornAt, String placeOfBirth, String birthCountry
});
@@ -300,11 +296,11 @@ class __$SignUpRequestEntityCopyWithImpl<$Res>
/// Create a copy of SignUpRequestEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? documentType = null,Object? documentNumber = null,Object? relationship = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,Object? taxResidences = null,Object? addresses = null,Object? bornAt = null,Object? userId = null,Object? placeOfBirth = null,Object? birthCountry = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? documentType = null,Object? document = null,Object? relationType = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,Object? taxResidences = null,Object? addresses = null,Object? bornAt = null,Object? placeOfBirth = null,Object? birthCountry = null,}) {
return _then(_SignUpRequestEntity(
documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
as String,documentNumber: null == documentNumber ? _self.documentNumber : documentNumber // ignore: cast_nullable_to_non_nullable
as String,relationship: null == relationship ? _self.relationship : relationship // ignore: cast_nullable_to_non_nullable
as String,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
as String,relationType: null == relationType ? _self.relationType : relationType // ignore: cast_nullable_to_non_nullable
as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
@@ -314,8 +310,7 @@ as String,password: null == password ? _self.password : password // ignore: cast
as String,taxResidences: null == taxResidences ? _self._taxResidences : taxResidences // ignore: cast_nullable_to_non_nullable
as List<AddressEntity>,addresses: null == addresses ? _self._addresses : addresses // ignore: cast_nullable_to_non_nullable
as List<AddressEntity>,bornAt: null == bornAt ? _self.bornAt : bornAt // ignore: cast_nullable_to_non_nullable
as int,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as String,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
as int,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
as String,birthCountry: null == birthCountry ? _self.birthCountry : birthCountry // ignore: cast_nullable_to_non_nullable
as String,
));

View File

@@ -0,0 +1,11 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'sign_up_response_entity.freezed.dart';
@freezed
abstract class SignUpResponseEntity with _$SignUpResponseEntity {
const factory SignUpResponseEntity({
required bool isCreated,
required String userId,
}) = _SignUpResponseEntity;
}

View File

@@ -0,0 +1,274 @@
// 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 'sign_up_response_entity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$SignUpResponseEntity {
bool get isCreated; String get userId;
/// Create a copy of SignUpResponseEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$SignUpResponseEntityCopyWith<SignUpResponseEntity> get copyWith => _$SignUpResponseEntityCopyWithImpl<SignUpResponseEntity>(this as SignUpResponseEntity, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SignUpResponseEntity&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.userId, userId) || other.userId == userId));
}
@override
int get hashCode => Object.hash(runtimeType,isCreated,userId);
@override
String toString() {
return 'SignUpResponseEntity(isCreated: $isCreated, userId: $userId)';
}
}
/// @nodoc
abstract mixin class $SignUpResponseEntityCopyWith<$Res> {
factory $SignUpResponseEntityCopyWith(SignUpResponseEntity value, $Res Function(SignUpResponseEntity) _then) = _$SignUpResponseEntityCopyWithImpl;
@useResult
$Res call({
bool isCreated, String userId
});
}
/// @nodoc
class _$SignUpResponseEntityCopyWithImpl<$Res>
implements $SignUpResponseEntityCopyWith<$Res> {
_$SignUpResponseEntityCopyWithImpl(this._self, this._then);
final SignUpResponseEntity _self;
final $Res Function(SignUpResponseEntity) _then;
/// Create a copy of SignUpResponseEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? isCreated = null,Object? userId = null,}) {
return _then(_self.copyWith(
isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable
as bool,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [SignUpResponseEntity].
extension SignUpResponseEntityPatterns on SignUpResponseEntity {
/// 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( _SignUpResponseEntity value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _SignUpResponseEntity() 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( _SignUpResponseEntity value) $default,){
final _that = this;
switch (_that) {
case _SignUpResponseEntity():
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( _SignUpResponseEntity value)? $default,){
final _that = this;
switch (_that) {
case _SignUpResponseEntity() 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( bool isCreated, String userId)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _SignUpResponseEntity() when $default != null:
return $default(_that.isCreated,_that.userId);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( bool isCreated, String userId) $default,) {final _that = this;
switch (_that) {
case _SignUpResponseEntity():
return $default(_that.isCreated,_that.userId);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( bool isCreated, String userId)? $default,) {final _that = this;
switch (_that) {
case _SignUpResponseEntity() when $default != null:
return $default(_that.isCreated,_that.userId);case _:
return null;
}
}
}
/// @nodoc
class _SignUpResponseEntity implements SignUpResponseEntity {
const _SignUpResponseEntity({required this.isCreated, required this.userId});
@override final bool isCreated;
@override final String userId;
/// Create a copy of SignUpResponseEntity
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$SignUpResponseEntityCopyWith<_SignUpResponseEntity> get copyWith => __$SignUpResponseEntityCopyWithImpl<_SignUpResponseEntity>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SignUpResponseEntity&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.userId, userId) || other.userId == userId));
}
@override
int get hashCode => Object.hash(runtimeType,isCreated,userId);
@override
String toString() {
return 'SignUpResponseEntity(isCreated: $isCreated, userId: $userId)';
}
}
/// @nodoc
abstract mixin class _$SignUpResponseEntityCopyWith<$Res> implements $SignUpResponseEntityCopyWith<$Res> {
factory _$SignUpResponseEntityCopyWith(_SignUpResponseEntity value, $Res Function(_SignUpResponseEntity) _then) = __$SignUpResponseEntityCopyWithImpl;
@override @useResult
$Res call({
bool isCreated, String userId
});
}
/// @nodoc
class __$SignUpResponseEntityCopyWithImpl<$Res>
implements _$SignUpResponseEntityCopyWith<$Res> {
__$SignUpResponseEntityCopyWithImpl(this._self, this._then);
final _SignUpResponseEntity _self;
final $Res Function(_SignUpResponseEntity) _then;
/// Create a copy of SignUpResponseEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? isCreated = null,Object? userId = null,}) {
return _then(_SignUpResponseEntity(
isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable
as bool,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -1,5 +1,6 @@
import 'package:auth/src/features/sign_up/domain/entities/sign_up_request_entity.dart';
import 'package:auth/src/features/sign_up/domain/entities/sign_up_response_entity.dart';
abstract class SignUpUseCase {
Future<String> signUp({required SignUpRequestEntity request});
Future<SignUpResponseEntity> signUp({required SignUpRequestEntity request});
}

View File

@@ -1,5 +1,6 @@
import 'package:auth/src/core/domain/repositories/auth_repository.dart';
import 'package:auth/src/features/sign_up/domain/entities/sign_up_request_entity.dart';
import 'package:auth/src/features/sign_up/domain/entities/sign_up_response_entity.dart';
import 'package:auth/src/features/sign_up/domain/sign_up_use_case.dart';
class SignUpUseCaseImpl implements SignUpUseCase {
@@ -8,7 +9,7 @@ class SignUpUseCaseImpl implements SignUpUseCase {
final AuthRepository _repository;
@override
Future<String> signUp({required SignUpRequestEntity request}) {
Future<SignUpResponseEntity> signUp({required SignUpRequestEntity request}) {
return _repository.signUp(request: request);
}
}

View File

@@ -5,16 +5,15 @@ import 'package:auth/src/features/sign_up/presentation/state/sign_up_view_state.
extension SignUpViewStateMapper on SignUpViewState {
bool get canSubmit =>
documentNumber.trim().isNotEmpty &&
document.trim().isNotEmpty &&
documentType.trim().isNotEmpty &&
relationship.trim().isNotEmpty &&
relationType.trim().isNotEmpty &&
firstName.trim().isNotEmpty &&
lastName.trim().isNotEmpty &&
email.trim().isNotEmpty &&
phone.trim().isNotEmpty &&
password.isNotEmpty &&
bornAt != null &&
userId.trim().isNotEmpty &&
placeOfBirth.trim().isNotEmpty &&
birthCountry.trim().isNotEmpty &&
address.isValid;
@@ -26,9 +25,9 @@ extension SignUpViewStateMapper on SignUpViewState {
}
return SignUpRequestEntity(
documentNumber: documentNumber.trim(),
document: document.trim(),
documentType: documentType.trim(),
relationship: relationship.trim(),
relationType: relationType.trim(),
firstName: firstName.trim(),
lastName: lastName.trim(),
email: email.trim(),
@@ -36,7 +35,6 @@ extension SignUpViewStateMapper on SignUpViewState {
language: language.trim(),
password: password,
bornAt: birth.millisecondsSinceEpoch,
userId: userId.trim(),
placeOfBirth: placeOfBirth.trim(),
birthCountry: birthCountry.trim(),
addresses: <AddressEntity>[address.toEntity()],

View File

@@ -1,281 +1,281 @@
import 'dart:convert';
// import 'dart:convert';
import 'package:auth/src/features/login/presentation/widgets/two_factor_bottom_sheet.dart';
import 'package:auth/src/features/sign_up/presentation/state/sign_up_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
// import 'package:auth/src/features/login/presentation/widgets/two_factor_bottom_sheet.dart';
// import 'package:auth/src/features/sign_up/presentation/state/sign_up_view_model.dart';
// import 'package:design_system/design_system.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter/services.dart';
// import 'package:flutter_riverpod/flutter_riverpod.dart';
// import 'package:navigation/navigation.dart';
// import 'package:sf_localizations/sf_localizations.dart';
class SecretCodeScreen extends ConsumerWidget {
final NavigationContract navigationContract;
// class SecretCodeScreen extends ConsumerWidget {
// final NavigationContract navigationContract;
const SecretCodeScreen({super.key, required this.navigationContract});
// const SecretCodeScreen({super.key, required this.navigationContract});
Uint8List? _qrBytes(String? dataUri) {
final value = (dataUri ?? '').trim();
if (value.isEmpty) return null;
// Uint8List? _qrBytes(String? dataUri) {
// final value = (dataUri ?? '').trim();
// if (value.isEmpty) return null;
final idx = value.indexOf('base64,');
final b64 = idx == -1 ? value : value.substring(idx + 7);
// final idx = value.indexOf('base64,');
// final b64 = idx == -1 ? value : value.substring(idx + 7);
try {
return base64Decode(b64);
} catch (_) {
return null;
}
}
// try {
// return base64Decode(b64);
// } catch (_) {
// return null;
// }
// }
Future<bool?> _openTwoFactorSignUpBottomSheet(
BuildContext context,
WidgetRef ref,
) async {
final token = ref.read(signUpViewModelProvider).token;
if (token.trim().isEmpty) return false;
// Future<bool?> _openTwoFactorSignUpBottomSheet(
// BuildContext context,
// WidgetRef ref,
// ) async {
// final token = ref.read(signUpViewModelProvider).token;
// if (token.trim().isEmpty) return false;
return showModalBottomSheet<bool>(
context: context,
isScrollControlled: true,
useSafeArea: true,
isDismissible: false,
enableDrag: false,
backgroundColor: Colors.transparent,
builder: (context) {
return Consumer(
builder: (context, ref, _) {
final theme = ref.watch(themePortProvider);
final vm = ref.read(signUpViewModelProvider.notifier);
// return showModalBottomSheet<bool>(
// context: context,
// isScrollControlled: true,
// useSafeArea: true,
// isDismissible: false,
// enableDrag: false,
// backgroundColor: Colors.transparent,
// builder: (context) {
// return Consumer(
// builder: (context, ref, _) {
// final theme = ref.watch(themePortProvider);
// final vm = ref.read(signUpViewModelProvider.notifier);
final otpErrorKey = ref.watch(
signUpViewModelProvider.select((s) => s.otpError),
);
final isOtpLoading = ref.watch(
signUpViewModelProvider.select((s) => s.isOtpLoading),
);
final otpCode = ref.watch(
signUpViewModelProvider.select((s) => s.otpCode),
);
// final otpErrorKey = ref.watch(
// signUpViewModelProvider.select((s) => s.otpError),
// );
// final isOtpLoading = ref.watch(
// signUpViewModelProvider.select((s) => s.isOtpLoading),
// );
// final otpCode = ref.watch(
// signUpViewModelProvider.select((s) => s.otpCode),
// );
final otpErrorText = otpErrorKey.isEmpty
? ''
: context.translate(otpErrorKey);
// final otpErrorText = otpErrorKey.isEmpty
// ? ''
// : context.translate(otpErrorKey);
Future<void> onVerify() async {
FocusManager.instance.primaryFocus?.unfocus();
// Future<void> onVerify() async {
// FocusManager.instance.primaryFocus?.unfocus();
final ok = await vm.verifyTwoFACodeSignUp(token: token);
if (!context.mounted) return;
// final ok = await vm.verifyTwoFACodeSignUp(token: token);
// if (!context.mounted) return;
if (ok) Navigator.of(context).pop(true);
}
// if (ok) Navigator.of(context).pop(true);
// }
return TwoFactorBottomSheetView(
theme: theme,
title: context.translate(I18n.twoFactorTitle),
subtitle: context.translate(I18n.twoFactorSubtitle),
verifyText: context.translate(I18n.twoFactorVerify),
closeText: context.translate(I18n.close),
isOtpLoading: isOtpLoading,
otpCode: otpCode,
otpErrorText: otpErrorText,
onChanged: vm.setOtpCode,
onVerify: onVerify,
onClose: () => Navigator.of(context).pop(false),
);
},
);
},
);
}
// return TwoFactorBottomSheetView(
// theme: theme,
// title: context.translate(I18n.twoFactorTitle),
// subtitle: context.translate(I18n.twoFactorSubtitle),
// verifyText: context.translate(I18n.twoFactorVerify),
// closeText: context.translate(I18n.close),
// isOtpLoading: isOtpLoading,
// otpCode: otpCode,
// otpErrorText: otpErrorText,
// onChanged: vm.setOtpCode,
// onVerify: onVerify,
// onClose: () => Navigator.of(context).pop(false),
// );
// },
// );
// },
// );
// }
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
final vm = ref.read(signUpViewModelProvider.notifier);
final state = ref.watch(signUpViewModelProvider);
// @override
// Widget build(BuildContext context, WidgetRef ref) {
// final theme = ref.watch(themePortProvider);
// final vm = ref.read(signUpViewModelProvider.notifier);
// final state = ref.watch(signUpViewModelProvider);
final secret = state.twoFASecret?.item.secret.trim() ?? '';
final qrDataUri = state.twoFASecret?.item.qr;
final qrBytes = _qrBytes(qrDataUri);
// final secret = state.twoFASecret?.item.secret.trim() ?? '';
// final qrDataUri = state.twoFASecret?.item.qr;
// final qrBytes = _qrBytes(qrDataUri);
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: SafeArea(
child: SingleChildScrollView(
padding: const EdgeInsets.fromLTRB(24, 8, 24, 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
context.translate(I18n.secretCodeTitle),
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w700,
color: theme.getColorFor(ThemeCode.textPrimary),
),
),
const SizedBox(height: 20),
// return Scaffold(
// backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
// body: SafeArea(
// child: SingleChildScrollView(
// padding: const EdgeInsets.fromLTRB(24, 8, 24, 24),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// context.translate(I18n.secretCodeTitle),
// style: TextStyle(
// fontSize: 20,
// fontWeight: FontWeight.w700,
// color: theme.getColorFor(ThemeCode.textPrimary),
// ),
// ),
// const SizedBox(height: 20),
_StepBlock(
theme: theme,
number: '1.',
title: context.translate(I18n.secretCodeStep1Title),
body: context.translate(I18n.secretCodeStep1Body),
),
const SizedBox(height: 14),
// _StepBlock(
// theme: theme,
// number: '1.',
// title: context.translate(I18n.secretCodeStep1Title),
// body: context.translate(I18n.secretCodeStep1Body),
// ),
// const SizedBox(height: 14),
_StepBlock(
theme: theme,
number: '2.',
title: context.translate(I18n.secretCodeStep2Title),
body: context.translate(I18n.secretCodeStep2Body),
),
const SizedBox(height: 12),
// _StepBlock(
// theme: theme,
// number: '2.',
// title: context.translate(I18n.secretCodeStep2Title),
// body: context.translate(I18n.secretCodeStep2Body),
// ),
// const SizedBox(height: 12),
Center(
child: Container(
width: 150,
height: 150,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
border: Border.all(width: 1, color: Colors.black),
color: theme.getColorFor(ThemeCode.backgroundSecondary),
),
child: qrBytes == null
? const Center(child: Icon(Icons.qr_code_2, size: 60))
: ClipRRect(
borderRadius: BorderRadius.circular(12),
child: Image.memory(qrBytes, fit: BoxFit.cover),
),
),
),
const SizedBox(height: 12),
// Center(
// child: Container(
// width: 150,
// height: 150,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(12),
// border: Border.all(width: 1, color: Colors.black),
// color: theme.getColorFor(ThemeCode.backgroundSecondary),
// ),
// child: qrBytes == null
// ? const Center(child: Icon(Icons.qr_code_2, size: 60))
// : ClipRRect(
// borderRadius: BorderRadius.circular(12),
// child: Image.memory(qrBytes, fit: BoxFit.cover),
// ),
// ),
// ),
// const SizedBox(height: 12),
Center(
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 14,
vertical: 10,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: theme.getColorFor(ThemeCode.backgroundSecondary),
border: Border.all(width: 1, color: Colors.black),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
secret,
style: TextStyle(
fontWeight: FontWeight.w700,
letterSpacing: 1.1,
color: theme.getColorFor(ThemeCode.textPrimary),
),
),
const SizedBox(width: 10),
IconButton(
visualDensity: VisualDensity.compact,
padding: EdgeInsets.zero,
constraints: const BoxConstraints(),
icon: const Icon(Icons.copy, size: 18),
onPressed: secret.isEmpty
? null
: () async {
await Clipboard.setData(
ClipboardData(text: secret),
);
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
context.translate(
I18n.secretCodeKeyCopied,
),
),
),
);
},
),
],
),
),
),
// Center(
// child: Container(
// padding: const EdgeInsets.symmetric(
// horizontal: 14,
// vertical: 10,
// ),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(10),
// color: theme.getColorFor(ThemeCode.backgroundSecondary),
// border: Border.all(width: 1, color: Colors.black),
// ),
// child: Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Text(
// secret,
// style: TextStyle(
// fontWeight: FontWeight.w700,
// letterSpacing: 1.1,
// color: theme.getColorFor(ThemeCode.textPrimary),
// ),
// ),
// const SizedBox(width: 10),
// IconButton(
// visualDensity: VisualDensity.compact,
// padding: EdgeInsets.zero,
// constraints: const BoxConstraints(),
// icon: const Icon(Icons.copy, size: 18),
// onPressed: secret.isEmpty
// ? null
// : () async {
// await Clipboard.setData(
// ClipboardData(text: secret),
// );
// if (!context.mounted) return;
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(
// content: Text(
// context.translate(
// I18n.secretCodeKeyCopied,
// ),
// ),
// ),
// );
// },
// ),
// ],
// ),
// ),
// ),
const SizedBox(height: 18),
_StepBlock(
theme: theme,
number: '3.',
title: context.translate(I18n.secretCodeStep3Title),
body: context.translate(I18n.secretCodeStep3Body),
),
// const SizedBox(height: 18),
// _StepBlock(
// theme: theme,
// number: '3.',
// title: context.translate(I18n.secretCodeStep3Title),
// body: context.translate(I18n.secretCodeStep3Body),
// ),
const SizedBox(height: 26),
PrimaryButton(
onPressed: () async {
final verified = await _openTwoFactorSignUpBottomSheet(
context,
ref,
);
if (!context.mounted) return;
// const SizedBox(height: 26),
// PrimaryButton(
// onPressed: () async {
// final verified = await _openTwoFactorSignUpBottomSheet(
// context,
// ref,
// );
// if (!context.mounted) return;
if (verified == true) {
vm.showAccountCreated();
}
},
text: context.translate(I18n.secretCodeConfigure),
color: theme.getColorFor(ThemeCode.buttonPrimary),
),
],
),
),
),
);
}
}
// if (verified == true) {
// vm.showAccountCreated();
// }
// },
// text: context.translate(I18n.secretCodeConfigure),
// color: theme.getColorFor(ThemeCode.buttonPrimary),
// ),
// ],
// ),
// ),
// ),
// );
// }
// }
class _StepBlock extends StatelessWidget {
final ThemePort theme;
final String number;
final String title;
final String body;
// class _StepBlock extends StatelessWidget {
// final ThemePort theme;
// final String number;
// final String title;
// final String body;
const _StepBlock({
required this.theme,
required this.number,
required this.title,
required this.body,
});
// const _StepBlock({
// required this.theme,
// required this.number,
// required this.title,
// required this.body,
// });
@override
Widget build(BuildContext context) {
return RichText(
text: TextSpan(
style: TextStyle(
height: 1.35,
fontSize: 14,
color: theme.getColorFor(ThemeCode.textPrimary),
),
children: [
TextSpan(
text: '$number ',
style: const TextStyle(fontWeight: FontWeight.w700),
),
TextSpan(
text: '$title\n',
style: const TextStyle(fontWeight: FontWeight.w700),
),
TextSpan(
text: body,
style: TextStyle(
fontWeight: FontWeight.w400,
color: theme.getColorFor(ThemeCode.textSecondary),
),
),
],
),
);
}
}
// @override
// Widget build(BuildContext context) {
// return RichText(
// text: TextSpan(
// style: TextStyle(
// height: 1.35,
// fontSize: 14,
// color: theme.getColorFor(ThemeCode.textPrimary),
// ),
// children: [
// TextSpan(
// text: '$number ',
// style: const TextStyle(fontWeight: FontWeight.w700),
// ),
// TextSpan(
// text: '$title\n',
// style: const TextStyle(fontWeight: FontWeight.w700),
// ),
// TextSpan(
// text: body,
// style: TextStyle(
// fontWeight: FontWeight.w400,
// color: theme.getColorFor(ThemeCode.textSecondary),
// ),
// ),
// ],
// ),
// );
// }
// }

View File

@@ -43,10 +43,6 @@ class SignupScreen extends ConsumerWidget {
final index = state.currentIndex.clamp(0, steps.length - 1);
final step = steps[index];
if (state.showSecretCode) {
return SecretCodeScreen(navigationContract: navigationContract);
}
if (state.showAccountCreated) {
return AccountCreatedScreen(navigationContract: navigationContract);
}

View File

@@ -93,9 +93,9 @@ List<SignUpStepConfig> signUpSteps(BuildContext context) => [
final relationshipKeys = <String, String>{
for (final e in relationshipLabel.entries) e.value: e.key,
};
final String? relationshipSelected = state.relationship.trim().isEmpty
final String? relationshipSelected = state.relationType.trim().isEmpty
? null
: relationshipLabel[state.relationship];
: relationshipLabel[state.relationType];
return SignupAddressScreen(
bornAtController: vm.bornAtController,

View File

@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:auth/src/features/sign_up/domain/entities/address_entity.dart';
import 'package:auth/src/features/sign_up/domain/entities/sign_up_request_entity.dart';
import 'package:auth/src/features/sign_up/domain/entities/sign_up_response_entity.dart';
import 'package:auth/src/features/sign_up/domain/entities/two_fa_secret_entity.dart';
import 'package:auth/src/features/sign_up/domain/generate_two_fa_sign_up_use_case.dart';
import 'package:auth/src/features/sign_up/domain/sign_up_use_case.dart';
@@ -14,7 +15,6 @@ import 'package:auth/src/features/sign_up/presentation/state/sign_up_view_state.
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:uuid/uuid.dart';
final signUpViewModelProvider =
NotifierProvider.autoDispose<SignUpViewModel, SignUpViewState>(
@@ -23,8 +23,6 @@ final signUpViewModelProvider =
class SignUpViewModel extends Notifier<SignUpViewState> {
late final SignUpUseCase _signUpUseCase;
late final GenerateTwoFASignUpUseCase _generateTwoFASignUpUseCase;
late final VerifyTwoFACodeSignUpUseCase _verifyTwoFACodeSignUpUseCase;
late final TextEditingController firstNameController;
late final TextEditingController lastNameController;
@@ -60,11 +58,8 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
@override
SignUpViewState build() {
_signUpUseCase = ref.read(signUpUseCaseProvider);
_generateTwoFASignUpUseCase = ref.read(generateTwoFASignUpUseCaseProvider);
_verifyTwoFACodeSignUpUseCase = ref.read(
verifyTwoFACodeSignUpUseCaseProvider,
);
final initial = SignUpViewState(userId: const Uuid().v4());
final initial = SignUpViewState();
_initControllers(initial);
_addListeners();
@@ -76,12 +71,12 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
void _initControllers(SignUpViewState s) {
firstNameController = TextEditingController(text: s.firstName);
lastNameController = TextEditingController(text: s.lastName);
documentNumberController = TextEditingController(text: s.documentNumber);
documentNumberController = TextEditingController(text: s.document);
documentTypeController = TextEditingController(text: s.documentType);
phoneController = TextEditingController(text: s.phone);
emailController = TextEditingController(text: s.email);
relationshipController = TextEditingController(text: s.relationship);
relationshipController = TextEditingController(text: s.relationType);
bornAtController = TextEditingController(
text: s.bornAt == null ? '' : _formatDate(s.bornAt!),
@@ -228,8 +223,8 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
void _onDocumentNumberChanged() {
final text = documentNumberController.text;
if (text == state.documentNumber) return;
state = state.copyWith(documentNumber: text, errorMessage: '');
if (text == state.document) return;
state = state.copyWith(document: text, errorMessage: '');
}
void _onDocumentTypeChanged() {
@@ -240,8 +235,8 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
void _onRelationshipChanged() {
final text = relationshipController.text;
if (text == state.relationship) return;
state = state.copyWith(relationship: text, errorMessage: '');
if (text == state.relationType) return;
state = state.copyWith(relationType: text, errorMessage: '');
}
void _onPhoneChanged() {
@@ -393,10 +388,6 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
}
}
void setOtpCode(String code) {
state = state.copyWith(otpCode: code, otpError: '');
}
bool _validateStep0() {
final emailError = _emailErrorFor(state.email);
final phoneError = _phoneErrorFor(state.phone);
@@ -420,7 +411,7 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
);
return false;
}
if (state.documentNumber.trim().isEmpty) {
if (state.document.trim().isEmpty) {
state = state.copyWith(
errorMessage: 'El número de documento es obligatorio',
);
@@ -455,7 +446,7 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
);
return false;
}
if (state.relationship.trim().isEmpty) {
if (state.relationType.trim().isEmpty) {
state = state.copyWith(errorMessage: 'La relación es obligatoria');
return false;
}
@@ -559,8 +550,8 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
return SignUpRequestEntity(
documentType: state.documentType.trim(),
documentNumber: state.documentNumber.trim(),
relationship: state.relationship.trim(),
document: state.document.trim(),
relationType: state.relationType.trim(),
firstName: state.firstName.trim(),
lastName: state.lastName.trim(),
email: state.email.trim(),
@@ -568,7 +559,6 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
language: state.language.trim().isEmpty ? 'es' : state.language.trim(),
password: state.password,
bornAt: bornAt.millisecondsSinceEpoch,
userId: state.userId.trim(),
placeOfBirth: state.placeOfBirth.trim(),
birthCountry: state.birthCountryCode.trim(),
// birthCountry: 'spain',
@@ -586,19 +576,10 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
try {
final request = _toRequest();
final token = await _signUp(request);
final response = await _signUp(request);
if (!ref.mounted) return false;
final secretEntity = await _generateTwoFA(token);
if (!ref.mounted) return false;
final validationError = _twoFAResponseError(secretEntity);
if (validationError != null) {
_finishWithError(token: token, message: validationError);
return false;
}
state = state.copyWith(showSecretCode: true);
_finishWithSuccess(token: token, twoFASecret: secretEntity);
_finishWithSuccess(isCreated: response.isCreated);
return true;
} catch (e) {
if (!ref.mounted) return false;
@@ -611,86 +592,31 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
state = state.copyWith(
isLoading: true,
errorMessage: '',
twoFASecret: null,
showSecretCode: false,
showAccountCreated: false,
);
}
Future<String> _signUp(SignUpRequestEntity request) async {
Future<SignUpResponseEntity> _signUp(SignUpRequestEntity request) {
return _signUpUseCase.signUp(request: request);
}
Future<TwoFASecretEntity> _generateTwoFA(String token) async {
return _generateTwoFASignUpUseCase.generateTwoFASignUp(token: token);
}
Future<bool> verifyTwoFACodeSignUp({required String token}) async {
if (state.isOtpLoading) return false;
final code = state.otpCode.trim();
if (code.length != 6) {
state = state.copyWith(otpError: 'error otp');
return false;
}
state = state.copyWith(isOtpLoading: true, otpError: '');
try {
await _verifyTwoFACodeSignUpUseCase.verifyTwoFACodeSignUp(
token: token,
code: code,
);
if (!ref.mounted) return false;
state = state.copyWith(isOtpLoading: false);
return true;
} catch (e) {
if (!ref.mounted) return false;
state = state.copyWith(isOtpLoading: false, otpError: e.toString());
return false;
}
}
String? _twoFAResponseError(TwoFASecretEntity entity) {
if (!entity.isCreated) {
return 'No se pudo generar el 2FA (isCreated=false)';
}
final secret = entity.item.secret.trim();
final qr = entity.item.qr.trim();
if (secret.isEmpty || qr.isEmpty) {
return 'Respuesta inválida del 2FA (secret/qr vacío)';
}
return null;
}
void _finishWithSuccess({
required String token,
required TwoFASecretEntity twoFASecret,
}) {
void _finishWithSuccess({required bool isCreated}) {
state = state.copyWith(
isLoading: false,
token: token,
twoFASecret: twoFASecret,
isCreated: isCreated,
errorMessage: '',
showAccountCreated: true,
);
}
void _finishWithError({String? token, required String message}) {
void _finishWithError({bool? isCreated, required String message}) {
state = state.copyWith(
isLoading: false,
token: token ?? state.token,
isCreated: isCreated ?? state.isCreated,
errorMessage: message,
);
}
void showAccountCreated() {
state = state.copyWith(showAccountCreated: true, showSecretCode: false);
}
DateTime? _tryParseDate(String value) {
final v = value.trim();
if (v.isEmpty) return null;

View File

@@ -9,10 +9,10 @@ abstract class SignUpViewState with _$SignUpViewState {
const factory SignUpViewState({
@Default(0) int currentIndex,
@Default('') String documentNumber,
@Default('') String document,
@Default('') String documentType,
@Default(false) bool acceptTerms,
@Default('') String relationship,
@Default('') String relationType,
@Default('') String firstName,
@Default('') String lastName,
@@ -24,7 +24,7 @@ abstract class SignUpViewState with _$SignUpViewState {
@Default('') String password,
@Default('') String repeatPassword,
@Default(false) bool isShowPassword,
@Default('') String userId,
@Default(false) bool isCreated,
@Default('') String placeOfBirth,
@Default('España') String birthCountry,
@Default('ES') String birthCountryCode,
@@ -37,12 +37,6 @@ abstract class SignUpViewState with _$SignUpViewState {
@Default('') String errorMessage,
@Default(false) bool isLoading,
@Default(false) bool showErrors,
@Default('') String token,
TwoFASecretEntity? twoFASecret,
@Default('') String otpCode,
@Default('') String otpError,
@Default(false) bool isOtpLoading,
@Default(false) bool showAccountCreated,
@Default(false) bool showSecretCode,
}) = _SignUpViewState;
}

View File

@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$SignUpViewState {
int get currentIndex; String get documentNumber; String get documentType; bool get acceptTerms; String get relationship; String get firstName; String get lastName; String get email; String get phone; String get dialCode; String get language; DateTime? get bornAt; String get password; String get repeatPassword; bool get isShowPassword; String get userId; String get placeOfBirth; String get birthCountry; String get birthCountryCode; AddressViewState get address; String get emailError; String get passwordError; String get phoneError; String get errorMessage; bool get isLoading; bool get showErrors; String get token; TwoFASecretEntity? get twoFASecret; String get otpCode; String get otpError; bool get isOtpLoading; bool get showAccountCreated; bool get showSecretCode;
int get currentIndex; String get document; String get documentType; bool get acceptTerms; String get relationType; String get firstName; String get lastName; String get email; String get phone; String get dialCode; String get language; DateTime? get bornAt; String get password; String get repeatPassword; bool get isShowPassword; bool get isCreated; String get placeOfBirth; String get birthCountry; String get birthCountryCode; AddressViewState get address; String get emailError; String get passwordError; String get phoneError; String get errorMessage; bool get isLoading; bool get showErrors; bool get showAccountCreated;
/// Create a copy of SignUpViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -25,16 +25,16 @@ $SignUpViewStateCopyWith<SignUpViewState> get copyWith => _$SignUpViewStateCopyW
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.documentNumber, documentNumber) || other.documentNumber == documentNumber)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.relationship, relationship) || other.relationship == relationship)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.language, language) || other.language == language)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.isShowPassword, isShowPassword) || other.isShowPassword == isShowPassword)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.birthCountryCode, birthCountryCode) || other.birthCountryCode == birthCountryCode)&&(identical(other.address, address) || other.address == address)&&(identical(other.emailError, emailError) || other.emailError == emailError)&&(identical(other.passwordError, passwordError) || other.passwordError == passwordError)&&(identical(other.phoneError, phoneError) || other.phoneError == phoneError)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.showErrors, showErrors) || other.showErrors == showErrors)&&(identical(other.token, token) || other.token == token)&&(identical(other.twoFASecret, twoFASecret) || other.twoFASecret == twoFASecret)&&(identical(other.otpCode, otpCode) || other.otpCode == otpCode)&&(identical(other.otpError, otpError) || other.otpError == otpError)&&(identical(other.isOtpLoading, isOtpLoading) || other.isOtpLoading == isOtpLoading)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated)&&(identical(other.showSecretCode, showSecretCode) || other.showSecretCode == showSecretCode));
return identical(this, other) || (other.runtimeType == runtimeType&&other is SignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.document, document) || other.document == document)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.relationType, relationType) || other.relationType == relationType)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.language, language) || other.language == language)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.isShowPassword, isShowPassword) || other.isShowPassword == isShowPassword)&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.birthCountryCode, birthCountryCode) || other.birthCountryCode == birthCountryCode)&&(identical(other.address, address) || other.address == address)&&(identical(other.emailError, emailError) || other.emailError == emailError)&&(identical(other.passwordError, passwordError) || other.passwordError == passwordError)&&(identical(other.phoneError, phoneError) || other.phoneError == phoneError)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.showErrors, showErrors) || other.showErrors == showErrors)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated));
}
@override
int get hashCode => Object.hashAll([runtimeType,currentIndex,documentNumber,documentType,acceptTerms,relationship,firstName,lastName,email,phone,dialCode,language,bornAt,password,repeatPassword,isShowPassword,userId,placeOfBirth,birthCountry,birthCountryCode,address,emailError,passwordError,phoneError,errorMessage,isLoading,showErrors,token,twoFASecret,otpCode,otpError,isOtpLoading,showAccountCreated,showSecretCode]);
int get hashCode => Object.hashAll([runtimeType,currentIndex,document,documentType,acceptTerms,relationType,firstName,lastName,email,phone,dialCode,language,bornAt,password,repeatPassword,isShowPassword,isCreated,placeOfBirth,birthCountry,birthCountryCode,address,emailError,passwordError,phoneError,errorMessage,isLoading,showErrors,showAccountCreated]);
@override
String toString() {
return 'SignUpViewState(currentIndex: $currentIndex, documentNumber: $documentNumber, documentType: $documentType, acceptTerms: $acceptTerms, relationship: $relationship, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, dialCode: $dialCode, language: $language, bornAt: $bornAt, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, userId: $userId, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, birthCountryCode: $birthCountryCode, address: $address, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, errorMessage: $errorMessage, isLoading: $isLoading, showErrors: $showErrors, token: $token, twoFASecret: $twoFASecret, otpCode: $otpCode, otpError: $otpError, isOtpLoading: $isOtpLoading, showAccountCreated: $showAccountCreated, showSecretCode: $showSecretCode)';
return 'SignUpViewState(currentIndex: $currentIndex, document: $document, documentType: $documentType, acceptTerms: $acceptTerms, relationType: $relationType, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, dialCode: $dialCode, language: $language, bornAt: $bornAt, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, isCreated: $isCreated, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, birthCountryCode: $birthCountryCode, address: $address, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, errorMessage: $errorMessage, isLoading: $isLoading, showErrors: $showErrors, showAccountCreated: $showAccountCreated)';
}
@@ -45,11 +45,11 @@ abstract mixin class $SignUpViewStateCopyWith<$Res> {
factory $SignUpViewStateCopyWith(SignUpViewState value, $Res Function(SignUpViewState) _then) = _$SignUpViewStateCopyWithImpl;
@useResult
$Res call({
int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, String birthCountryCode, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated, bool showSecretCode
int currentIndex, String document, String documentType, bool acceptTerms, String relationType, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, bool isCreated, String placeOfBirth, String birthCountry, String birthCountryCode, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool showAccountCreated
});
$AddressViewStateCopyWith<$Res> get address;$TwoFASecretEntityCopyWith<$Res>? get twoFASecret;
$AddressViewStateCopyWith<$Res> get address;
}
/// @nodoc
@@ -62,13 +62,13 @@ class _$SignUpViewStateCopyWithImpl<$Res>
/// Create a copy of SignUpViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? currentIndex = null,Object? documentNumber = null,Object? documentType = null,Object? acceptTerms = null,Object? relationship = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? dialCode = null,Object? language = null,Object? bornAt = freezed,Object? password = null,Object? repeatPassword = null,Object? isShowPassword = null,Object? userId = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? birthCountryCode = null,Object? address = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? errorMessage = null,Object? isLoading = null,Object? showErrors = null,Object? token = null,Object? twoFASecret = freezed,Object? otpCode = null,Object? otpError = null,Object? isOtpLoading = null,Object? showAccountCreated = null,Object? showSecretCode = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? currentIndex = null,Object? document = null,Object? documentType = null,Object? acceptTerms = null,Object? relationType = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? dialCode = null,Object? language = null,Object? bornAt = freezed,Object? password = null,Object? repeatPassword = null,Object? isShowPassword = null,Object? isCreated = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? birthCountryCode = null,Object? address = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? errorMessage = null,Object? isLoading = null,Object? showErrors = null,Object? showAccountCreated = null,}) {
return _then(_self.copyWith(
currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable
as int,documentNumber: null == documentNumber ? _self.documentNumber : documentNumber // ignore: cast_nullable_to_non_nullable
as int,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
as String,documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
as String,acceptTerms: null == acceptTerms ? _self.acceptTerms : acceptTerms // ignore: cast_nullable_to_non_nullable
as bool,relationship: null == relationship ? _self.relationship : relationship // ignore: cast_nullable_to_non_nullable
as bool,relationType: null == relationType ? _self.relationType : relationType // ignore: cast_nullable_to_non_nullable
as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
@@ -79,8 +79,8 @@ as String,bornAt: freezed == bornAt ? _self.bornAt : bornAt // ignore: cast_null
as DateTime?,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String,repeatPassword: null == repeatPassword ? _self.repeatPassword : repeatPassword // ignore: cast_nullable_to_non_nullable
as String,isShowPassword: null == isShowPassword ? _self.isShowPassword : isShowPassword // ignore: cast_nullable_to_non_nullable
as bool,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as String,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
as bool,isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable
as bool,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
as String,birthCountry: null == birthCountry ? _self.birthCountry : birthCountry // ignore: cast_nullable_to_non_nullable
as String,birthCountryCode: null == birthCountryCode ? _self.birthCountryCode : birthCountryCode // ignore: cast_nullable_to_non_nullable
as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
@@ -90,13 +90,7 @@ as String,phoneError: null == phoneError ? _self.phoneError : phoneError // igno
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,showErrors: null == showErrors ? _self.showErrors : showErrors // ignore: cast_nullable_to_non_nullable
as bool,token: null == token ? _self.token : token // ignore: cast_nullable_to_non_nullable
as String,twoFASecret: freezed == twoFASecret ? _self.twoFASecret : twoFASecret // ignore: cast_nullable_to_non_nullable
as TwoFASecretEntity?,otpCode: null == otpCode ? _self.otpCode : otpCode // ignore: cast_nullable_to_non_nullable
as String,otpError: null == otpError ? _self.otpError : otpError // ignore: cast_nullable_to_non_nullable
as String,isOtpLoading: null == isOtpLoading ? _self.isOtpLoading : isOtpLoading // ignore: cast_nullable_to_non_nullable
as bool,showAccountCreated: null == showAccountCreated ? _self.showAccountCreated : showAccountCreated // ignore: cast_nullable_to_non_nullable
as bool,showSecretCode: null == showSecretCode ? _self.showSecretCode : showSecretCode // ignore: cast_nullable_to_non_nullable
as bool,
));
}
@@ -109,18 +103,6 @@ $AddressViewStateCopyWith<$Res> get address {
return $AddressViewStateCopyWith<$Res>(_self.address, (value) {
return _then(_self.copyWith(address: value));
});
}/// Create a copy of SignUpViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$TwoFASecretEntityCopyWith<$Res>? get twoFASecret {
if (_self.twoFASecret == null) {
return null;
}
return $TwoFASecretEntityCopyWith<$Res>(_self.twoFASecret!, (value) {
return _then(_self.copyWith(twoFASecret: value));
});
}
}
@@ -203,10 +185,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, String birthCountryCode, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated, bool showSecretCode)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int currentIndex, String document, String documentType, bool acceptTerms, String relationType, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, bool isCreated, String placeOfBirth, String birthCountry, String birthCountryCode, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool showAccountCreated)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _SignUpViewState() when $default != null:
return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that.acceptTerms,_that.relationship,_that.firstName,_that.lastName,_that.email,_that.phone,_that.dialCode,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.birthCountryCode,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.token,_that.twoFASecret,_that.otpCode,_that.otpError,_that.isOtpLoading,_that.showAccountCreated,_that.showSecretCode);case _:
return $default(_that.currentIndex,_that.document,_that.documentType,_that.acceptTerms,_that.relationType,_that.firstName,_that.lastName,_that.email,_that.phone,_that.dialCode,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.isCreated,_that.placeOfBirth,_that.birthCountry,_that.birthCountryCode,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.showAccountCreated);case _:
return orElse();
}
@@ -224,10 +206,10 @@ return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, String birthCountryCode, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated, bool showSecretCode) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int currentIndex, String document, String documentType, bool acceptTerms, String relationType, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, bool isCreated, String placeOfBirth, String birthCountry, String birthCountryCode, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool showAccountCreated) $default,) {final _that = this;
switch (_that) {
case _SignUpViewState():
return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that.acceptTerms,_that.relationship,_that.firstName,_that.lastName,_that.email,_that.phone,_that.dialCode,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.birthCountryCode,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.token,_that.twoFASecret,_that.otpCode,_that.otpError,_that.isOtpLoading,_that.showAccountCreated,_that.showSecretCode);case _:
return $default(_that.currentIndex,_that.document,_that.documentType,_that.acceptTerms,_that.relationType,_that.firstName,_that.lastName,_that.email,_that.phone,_that.dialCode,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.isCreated,_that.placeOfBirth,_that.birthCountry,_that.birthCountryCode,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.showAccountCreated);case _:
throw StateError('Unexpected subclass');
}
@@ -244,10 +226,10 @@ return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, String birthCountryCode, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated, bool showSecretCode)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int currentIndex, String document, String documentType, bool acceptTerms, String relationType, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, bool isCreated, String placeOfBirth, String birthCountry, String birthCountryCode, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool showAccountCreated)? $default,) {final _that = this;
switch (_that) {
case _SignUpViewState() when $default != null:
return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that.acceptTerms,_that.relationship,_that.firstName,_that.lastName,_that.email,_that.phone,_that.dialCode,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.birthCountryCode,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.token,_that.twoFASecret,_that.otpCode,_that.otpError,_that.isOtpLoading,_that.showAccountCreated,_that.showSecretCode);case _:
return $default(_that.currentIndex,_that.document,_that.documentType,_that.acceptTerms,_that.relationType,_that.firstName,_that.lastName,_that.email,_that.phone,_that.dialCode,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.isCreated,_that.placeOfBirth,_that.birthCountry,_that.birthCountryCode,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.showAccountCreated);case _:
return null;
}
@@ -259,14 +241,14 @@ return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that
class _SignUpViewState implements SignUpViewState {
const _SignUpViewState({this.currentIndex = 0, this.documentNumber = '', this.documentType = '', this.acceptTerms = false, this.relationship = '', this.firstName = '', this.lastName = '', this.email = '', this.phone = '', this.dialCode = '+34', this.language = '', this.bornAt, this.password = '', this.repeatPassword = '', this.isShowPassword = false, this.userId = '', this.placeOfBirth = '', this.birthCountry = 'España', this.birthCountryCode = 'ES', this.address = const AddressViewState(), this.emailError = '', this.passwordError = '', this.phoneError = '', this.errorMessage = '', this.isLoading = false, this.showErrors = false, this.token = '', this.twoFASecret, this.otpCode = '', this.otpError = '', this.isOtpLoading = false, this.showAccountCreated = false, this.showSecretCode = false});
const _SignUpViewState({this.currentIndex = 0, this.document = '', this.documentType = '', this.acceptTerms = false, this.relationType = '', this.firstName = '', this.lastName = '', this.email = '', this.phone = '', this.dialCode = '+34', this.language = '', this.bornAt, this.password = '', this.repeatPassword = '', this.isShowPassword = false, this.isCreated = false, this.placeOfBirth = '', this.birthCountry = 'España', this.birthCountryCode = 'ES', this.address = const AddressViewState(), this.emailError = '', this.passwordError = '', this.phoneError = '', this.errorMessage = '', this.isLoading = false, this.showErrors = false, this.showAccountCreated = false});
@override@JsonKey() final int currentIndex;
@override@JsonKey() final String documentNumber;
@override@JsonKey() final String document;
@override@JsonKey() final String documentType;
@override@JsonKey() final bool acceptTerms;
@override@JsonKey() final String relationship;
@override@JsonKey() final String relationType;
@override@JsonKey() final String firstName;
@override@JsonKey() final String lastName;
@override@JsonKey() final String email;
@@ -277,7 +259,7 @@ class _SignUpViewState implements SignUpViewState {
@override@JsonKey() final String password;
@override@JsonKey() final String repeatPassword;
@override@JsonKey() final bool isShowPassword;
@override@JsonKey() final String userId;
@override@JsonKey() final bool isCreated;
@override@JsonKey() final String placeOfBirth;
@override@JsonKey() final String birthCountry;
@override@JsonKey() final String birthCountryCode;
@@ -288,13 +270,7 @@ class _SignUpViewState implements SignUpViewState {
@override@JsonKey() final String errorMessage;
@override@JsonKey() final bool isLoading;
@override@JsonKey() final bool showErrors;
@override@JsonKey() final String token;
@override final TwoFASecretEntity? twoFASecret;
@override@JsonKey() final String otpCode;
@override@JsonKey() final String otpError;
@override@JsonKey() final bool isOtpLoading;
@override@JsonKey() final bool showAccountCreated;
@override@JsonKey() final bool showSecretCode;
/// Create a copy of SignUpViewState
/// with the given fields replaced by the non-null parameter values.
@@ -306,16 +282,16 @@ _$SignUpViewStateCopyWith<_SignUpViewState> get copyWith => __$SignUpViewStateCo
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.documentNumber, documentNumber) || other.documentNumber == documentNumber)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.relationship, relationship) || other.relationship == relationship)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.language, language) || other.language == language)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.isShowPassword, isShowPassword) || other.isShowPassword == isShowPassword)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.birthCountryCode, birthCountryCode) || other.birthCountryCode == birthCountryCode)&&(identical(other.address, address) || other.address == address)&&(identical(other.emailError, emailError) || other.emailError == emailError)&&(identical(other.passwordError, passwordError) || other.passwordError == passwordError)&&(identical(other.phoneError, phoneError) || other.phoneError == phoneError)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.showErrors, showErrors) || other.showErrors == showErrors)&&(identical(other.token, token) || other.token == token)&&(identical(other.twoFASecret, twoFASecret) || other.twoFASecret == twoFASecret)&&(identical(other.otpCode, otpCode) || other.otpCode == otpCode)&&(identical(other.otpError, otpError) || other.otpError == otpError)&&(identical(other.isOtpLoading, isOtpLoading) || other.isOtpLoading == isOtpLoading)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated)&&(identical(other.showSecretCode, showSecretCode) || other.showSecretCode == showSecretCode));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.document, document) || other.document == document)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.relationType, relationType) || other.relationType == relationType)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.language, language) || other.language == language)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.isShowPassword, isShowPassword) || other.isShowPassword == isShowPassword)&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.birthCountryCode, birthCountryCode) || other.birthCountryCode == birthCountryCode)&&(identical(other.address, address) || other.address == address)&&(identical(other.emailError, emailError) || other.emailError == emailError)&&(identical(other.passwordError, passwordError) || other.passwordError == passwordError)&&(identical(other.phoneError, phoneError) || other.phoneError == phoneError)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.showErrors, showErrors) || other.showErrors == showErrors)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated));
}
@override
int get hashCode => Object.hashAll([runtimeType,currentIndex,documentNumber,documentType,acceptTerms,relationship,firstName,lastName,email,phone,dialCode,language,bornAt,password,repeatPassword,isShowPassword,userId,placeOfBirth,birthCountry,birthCountryCode,address,emailError,passwordError,phoneError,errorMessage,isLoading,showErrors,token,twoFASecret,otpCode,otpError,isOtpLoading,showAccountCreated,showSecretCode]);
int get hashCode => Object.hashAll([runtimeType,currentIndex,document,documentType,acceptTerms,relationType,firstName,lastName,email,phone,dialCode,language,bornAt,password,repeatPassword,isShowPassword,isCreated,placeOfBirth,birthCountry,birthCountryCode,address,emailError,passwordError,phoneError,errorMessage,isLoading,showErrors,showAccountCreated]);
@override
String toString() {
return 'SignUpViewState(currentIndex: $currentIndex, documentNumber: $documentNumber, documentType: $documentType, acceptTerms: $acceptTerms, relationship: $relationship, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, dialCode: $dialCode, language: $language, bornAt: $bornAt, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, userId: $userId, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, birthCountryCode: $birthCountryCode, address: $address, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, errorMessage: $errorMessage, isLoading: $isLoading, showErrors: $showErrors, token: $token, twoFASecret: $twoFASecret, otpCode: $otpCode, otpError: $otpError, isOtpLoading: $isOtpLoading, showAccountCreated: $showAccountCreated, showSecretCode: $showSecretCode)';
return 'SignUpViewState(currentIndex: $currentIndex, document: $document, documentType: $documentType, acceptTerms: $acceptTerms, relationType: $relationType, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, dialCode: $dialCode, language: $language, bornAt: $bornAt, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, isCreated: $isCreated, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, birthCountryCode: $birthCountryCode, address: $address, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, errorMessage: $errorMessage, isLoading: $isLoading, showErrors: $showErrors, showAccountCreated: $showAccountCreated)';
}
@@ -326,11 +302,11 @@ abstract mixin class _$SignUpViewStateCopyWith<$Res> implements $SignUpViewState
factory _$SignUpViewStateCopyWith(_SignUpViewState value, $Res Function(_SignUpViewState) _then) = __$SignUpViewStateCopyWithImpl;
@override @useResult
$Res call({
int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, String birthCountryCode, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated, bool showSecretCode
int currentIndex, String document, String documentType, bool acceptTerms, String relationType, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, bool isCreated, String placeOfBirth, String birthCountry, String birthCountryCode, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool showAccountCreated
});
@override $AddressViewStateCopyWith<$Res> get address;@override $TwoFASecretEntityCopyWith<$Res>? get twoFASecret;
@override $AddressViewStateCopyWith<$Res> get address;
}
/// @nodoc
@@ -343,13 +319,13 @@ class __$SignUpViewStateCopyWithImpl<$Res>
/// Create a copy of SignUpViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? currentIndex = null,Object? documentNumber = null,Object? documentType = null,Object? acceptTerms = null,Object? relationship = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? dialCode = null,Object? language = null,Object? bornAt = freezed,Object? password = null,Object? repeatPassword = null,Object? isShowPassword = null,Object? userId = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? birthCountryCode = null,Object? address = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? errorMessage = null,Object? isLoading = null,Object? showErrors = null,Object? token = null,Object? twoFASecret = freezed,Object? otpCode = null,Object? otpError = null,Object? isOtpLoading = null,Object? showAccountCreated = null,Object? showSecretCode = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? currentIndex = null,Object? document = null,Object? documentType = null,Object? acceptTerms = null,Object? relationType = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? dialCode = null,Object? language = null,Object? bornAt = freezed,Object? password = null,Object? repeatPassword = null,Object? isShowPassword = null,Object? isCreated = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? birthCountryCode = null,Object? address = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? errorMessage = null,Object? isLoading = null,Object? showErrors = null,Object? showAccountCreated = null,}) {
return _then(_SignUpViewState(
currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable
as int,documentNumber: null == documentNumber ? _self.documentNumber : documentNumber // ignore: cast_nullable_to_non_nullable
as int,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
as String,documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
as String,acceptTerms: null == acceptTerms ? _self.acceptTerms : acceptTerms // ignore: cast_nullable_to_non_nullable
as bool,relationship: null == relationship ? _self.relationship : relationship // ignore: cast_nullable_to_non_nullable
as bool,relationType: null == relationType ? _self.relationType : relationType // ignore: cast_nullable_to_non_nullable
as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
@@ -360,8 +336,8 @@ as String,bornAt: freezed == bornAt ? _self.bornAt : bornAt // ignore: cast_null
as DateTime?,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String,repeatPassword: null == repeatPassword ? _self.repeatPassword : repeatPassword // ignore: cast_nullable_to_non_nullable
as String,isShowPassword: null == isShowPassword ? _self.isShowPassword : isShowPassword // ignore: cast_nullable_to_non_nullable
as bool,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as String,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
as bool,isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable
as bool,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
as String,birthCountry: null == birthCountry ? _self.birthCountry : birthCountry // ignore: cast_nullable_to_non_nullable
as String,birthCountryCode: null == birthCountryCode ? _self.birthCountryCode : birthCountryCode // ignore: cast_nullable_to_non_nullable
as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
@@ -371,13 +347,7 @@ as String,phoneError: null == phoneError ? _self.phoneError : phoneError // igno
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,showErrors: null == showErrors ? _self.showErrors : showErrors // ignore: cast_nullable_to_non_nullable
as bool,token: null == token ? _self.token : token // ignore: cast_nullable_to_non_nullable
as String,twoFASecret: freezed == twoFASecret ? _self.twoFASecret : twoFASecret // ignore: cast_nullable_to_non_nullable
as TwoFASecretEntity?,otpCode: null == otpCode ? _self.otpCode : otpCode // ignore: cast_nullable_to_non_nullable
as String,otpError: null == otpError ? _self.otpError : otpError // ignore: cast_nullable_to_non_nullable
as String,isOtpLoading: null == isOtpLoading ? _self.isOtpLoading : isOtpLoading // ignore: cast_nullable_to_non_nullable
as bool,showAccountCreated: null == showAccountCreated ? _self.showAccountCreated : showAccountCreated // ignore: cast_nullable_to_non_nullable
as bool,showSecretCode: null == showSecretCode ? _self.showSecretCode : showSecretCode // ignore: cast_nullable_to_non_nullable
as bool,
));
}
@@ -391,18 +361,6 @@ $AddressViewStateCopyWith<$Res> get address {
return $AddressViewStateCopyWith<$Res>(_self.address, (value) {
return _then(_self.copyWith(address: value));
});
}/// Create a copy of SignUpViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$TwoFASecretEntityCopyWith<$Res>? get twoFASecret {
if (_self.twoFASecret == null) {
return null;
}
return $TwoFASecretEntityCopyWith<$Res>(_self.twoFASecret!, (value) {
return _then(_self.copyWith(twoFASecret: value));
});
}
}