profile settings screen to show user information, move getPaymentProfile,getUserInfo,getChildProfiles request to sf shared, some refactors
This commit is contained in:
@@ -1,14 +1,10 @@
|
||||
import 'package:auth/src/core/data/models/child_profile_response_model.dart';
|
||||
import 'package:auth/src/core/data/models/payment_profile_response_model.dart';
|
||||
import 'package:auth/src/core/data/models/user_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/core/data/models/login_response_model.dart';
|
||||
|
||||
abstract class AuthRemoteDatasource {
|
||||
Future<UserModel> getUserInfo();
|
||||
|
||||
Future<void> requestPhoneCode({required String phone});
|
||||
|
||||
Future<void> verifyPhoneCode({required String phone, required String code});
|
||||
@@ -44,8 +40,6 @@ abstract class AuthRemoteDatasource {
|
||||
|
||||
Future<void> createWallet();
|
||||
|
||||
Future<PaymentProfileResponseModel> getPaymentProfile({required String userId});
|
||||
|
||||
Future<ChildProfileResponseModel> createChildProfile({
|
||||
required String id,
|
||||
required String parentId,
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:auth/src/core/data/models/child_profile_response_model.dart';
|
||||
import 'package:auth/src/core/data/models/payment_profile_response_model.dart';
|
||||
import 'package:auth/src/core/data/models/user_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';
|
||||
@@ -17,22 +15,6 @@ class AuthRemoteDatasourceImpl implements AuthRemoteDatasource {
|
||||
AuthRemoteDatasourceImpl(this._repository);
|
||||
|
||||
final QuestiaRepository _repository;
|
||||
@override
|
||||
Future<UserModel> getUserInfo() async {
|
||||
try {
|
||||
final response = await _repository.get<Map<String, dynamic>>('/auth/me');
|
||||
|
||||
final data = response.data;
|
||||
if (data == null || data.isEmpty) {
|
||||
throw Exception('Empty response from /auth/me');
|
||||
}
|
||||
|
||||
final parsed = UserResponseModel.fromJson(data);
|
||||
return parsed.item;
|
||||
} on DioException catch (error) {
|
||||
throw _mapDioError(error, defaultMessage: 'Error in /auth/me');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> requestPhoneCode({required String phone}) async {
|
||||
@@ -283,29 +265,6 @@ class AuthRemoteDatasourceImpl implements AuthRemoteDatasource {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<PaymentProfileResponseModel> getPaymentProfile({
|
||||
required String userId,
|
||||
}) async {
|
||||
try {
|
||||
final response = await _repository.get<Map<String, dynamic>>(
|
||||
'/users/$userId/payment-profile',
|
||||
);
|
||||
|
||||
final data = response.data;
|
||||
if (data == null || data.isEmpty) {
|
||||
throw Exception('Empty response from /users/$userId/payment-profile');
|
||||
}
|
||||
|
||||
return PaymentProfileResponseModel.fromJson(data);
|
||||
} on DioException catch (error) {
|
||||
throw _mapDioError(
|
||||
error,
|
||||
defaultMessage: 'Error in /users/$userId/payment-profile',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ChildProfileResponseModel> createChildProfile({
|
||||
required String id,
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import 'package:auth/src/core/data/models/user_response_model.dart';
|
||||
import 'package:auth/src/features/login/domain/entities/user_entity.dart';
|
||||
|
||||
extension UserModelMapper on UserModel {
|
||||
UserEntity toEntity() {
|
||||
return UserEntity(
|
||||
id: id,
|
||||
delegationId: delegationId,
|
||||
email: email,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
status: status,
|
||||
role: role,
|
||||
lastLogin: lastLogin,
|
||||
currentLogin: currentLogin,
|
||||
language: language,
|
||||
firstName: firstName,
|
||||
lastName: lastName,
|
||||
hasApiKey: hasApiKey,
|
||||
phone: phone,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
import 'package:auth/src/features/login/domain/entities/payment_profile_entity.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'payment_profile_response_model.freezed.dart';
|
||||
part 'payment_profile_response_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class PaymentProfileResponseModel with _$PaymentProfileResponseModel {
|
||||
const factory PaymentProfileResponseModel({
|
||||
required PaymentProfileItemModel item,
|
||||
}) = _PaymentProfileResponseModel;
|
||||
|
||||
factory PaymentProfileResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$PaymentProfileResponseModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class PaymentProfileItemModel with _$PaymentProfileItemModel {
|
||||
const factory PaymentProfileItemModel({
|
||||
required String id,
|
||||
required String userId,
|
||||
required String paymentProfileId,
|
||||
String? jwt,
|
||||
required int bornAt,
|
||||
required String phone,
|
||||
required List<PaymentProfileAddressModel> taxResidences,
|
||||
required List<PaymentProfileAddressModel> addresses,
|
||||
required String status,
|
||||
//talk with Hector to change those names in the backend to be more consistent with the rest of the fields
|
||||
// ignore: non_constant_identifier_names
|
||||
required String KYCStatus,
|
||||
// ignore: non_constant_identifier_names
|
||||
required String KYCLevel,
|
||||
required String placeOfBirth,
|
||||
required String birthCountry,
|
||||
required String nationality,
|
||||
required String documentType,
|
||||
required String document,
|
||||
String? paymentWalletId,
|
||||
required int createdAt,
|
||||
}) = _PaymentProfileItemModel;
|
||||
|
||||
factory PaymentProfileItemModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$PaymentProfileItemModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class PaymentProfileAddressModel with _$PaymentProfileAddressModel {
|
||||
const factory PaymentProfileAddressModel({
|
||||
required String street,
|
||||
required String city,
|
||||
required String province,
|
||||
required String state,
|
||||
required String country,
|
||||
required int postCode,
|
||||
}) = _PaymentProfileAddressModel;
|
||||
|
||||
factory PaymentProfileAddressModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$PaymentProfileAddressModelFromJson(json);
|
||||
}
|
||||
|
||||
extension PaymentProfileResponseModelMapper on PaymentProfileResponseModel {
|
||||
PaymentProfileEntity toEntity() {
|
||||
return PaymentProfileEntity(
|
||||
id: item.id,
|
||||
userId: item.userId,
|
||||
paymentProfileId: item.paymentProfileId,
|
||||
jwt: item.jwt,
|
||||
bornAt: item.bornAt,
|
||||
phone: item.phone,
|
||||
taxResidences: item.taxResidences
|
||||
.map(
|
||||
(a) => PaymentProfileAddressEntity(
|
||||
street: a.street,
|
||||
city: a.city,
|
||||
province: a.province,
|
||||
state: a.state,
|
||||
country: a.country,
|
||||
postCode: a.postCode,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
addresses: item.addresses
|
||||
.map(
|
||||
(a) => PaymentProfileAddressEntity(
|
||||
street: a.street,
|
||||
city: a.city,
|
||||
province: a.province,
|
||||
state: a.state,
|
||||
country: a.country,
|
||||
postCode: a.postCode,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
status: item.status,
|
||||
kycStatus: item.KYCStatus,
|
||||
kycLevel: item.KYCLevel,
|
||||
placeOfBirth: item.placeOfBirth,
|
||||
birthCountry: item.birthCountry,
|
||||
nationality: item.nationality,
|
||||
documentType: item.documentType,
|
||||
document: item.document,
|
||||
paymentWalletId: item.paymentWalletId,
|
||||
createdAt: item.createdAt,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,905 +0,0 @@
|
||||
// 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 'payment_profile_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$PaymentProfileResponseModel {
|
||||
|
||||
PaymentProfileItemModel get item;
|
||||
/// Create a copy of PaymentProfileResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$PaymentProfileResponseModelCopyWith<PaymentProfileResponseModel> get copyWith => _$PaymentProfileResponseModelCopyWithImpl<PaymentProfileResponseModel>(this as PaymentProfileResponseModel, _$identity);
|
||||
|
||||
/// Serializes this PaymentProfileResponseModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PaymentProfileResponseModel&&(identical(other.item, item) || other.item == item));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,item);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentProfileResponseModel(item: $item)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $PaymentProfileResponseModelCopyWith<$Res> {
|
||||
factory $PaymentProfileResponseModelCopyWith(PaymentProfileResponseModel value, $Res Function(PaymentProfileResponseModel) _then) = _$PaymentProfileResponseModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
PaymentProfileItemModel item
|
||||
});
|
||||
|
||||
|
||||
$PaymentProfileItemModelCopyWith<$Res> get item;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$PaymentProfileResponseModelCopyWithImpl<$Res>
|
||||
implements $PaymentProfileResponseModelCopyWith<$Res> {
|
||||
_$PaymentProfileResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final PaymentProfileResponseModel _self;
|
||||
final $Res Function(PaymentProfileResponseModel) _then;
|
||||
|
||||
/// Create a copy of PaymentProfileResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? item = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable
|
||||
as PaymentProfileItemModel,
|
||||
));
|
||||
}
|
||||
/// Create a copy of PaymentProfileResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$PaymentProfileItemModelCopyWith<$Res> get item {
|
||||
|
||||
return $PaymentProfileItemModelCopyWith<$Res>(_self.item, (value) {
|
||||
return _then(_self.copyWith(item: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [PaymentProfileResponseModel].
|
||||
extension PaymentProfileResponseModelPatterns on PaymentProfileResponseModel {
|
||||
/// 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( _PaymentProfileResponseModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileResponseModel() 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( _PaymentProfileResponseModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileResponseModel():
|
||||
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( _PaymentProfileResponseModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileResponseModel() 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( PaymentProfileItemModel item)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileResponseModel() when $default != null:
|
||||
return $default(_that.item);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( PaymentProfileItemModel item) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileResponseModel():
|
||||
return $default(_that.item);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( PaymentProfileItemModel item)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileResponseModel() when $default != null:
|
||||
return $default(_that.item);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _PaymentProfileResponseModel implements PaymentProfileResponseModel {
|
||||
const _PaymentProfileResponseModel({required this.item});
|
||||
factory _PaymentProfileResponseModel.fromJson(Map<String, dynamic> json) => _$PaymentProfileResponseModelFromJson(json);
|
||||
|
||||
@override final PaymentProfileItemModel item;
|
||||
|
||||
/// Create a copy of PaymentProfileResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$PaymentProfileResponseModelCopyWith<_PaymentProfileResponseModel> get copyWith => __$PaymentProfileResponseModelCopyWithImpl<_PaymentProfileResponseModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$PaymentProfileResponseModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PaymentProfileResponseModel&&(identical(other.item, item) || other.item == item));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,item);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentProfileResponseModel(item: $item)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$PaymentProfileResponseModelCopyWith<$Res> implements $PaymentProfileResponseModelCopyWith<$Res> {
|
||||
factory _$PaymentProfileResponseModelCopyWith(_PaymentProfileResponseModel value, $Res Function(_PaymentProfileResponseModel) _then) = __$PaymentProfileResponseModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
PaymentProfileItemModel item
|
||||
});
|
||||
|
||||
|
||||
@override $PaymentProfileItemModelCopyWith<$Res> get item;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$PaymentProfileResponseModelCopyWithImpl<$Res>
|
||||
implements _$PaymentProfileResponseModelCopyWith<$Res> {
|
||||
__$PaymentProfileResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _PaymentProfileResponseModel _self;
|
||||
final $Res Function(_PaymentProfileResponseModel) _then;
|
||||
|
||||
/// Create a copy of PaymentProfileResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? item = null,}) {
|
||||
return _then(_PaymentProfileResponseModel(
|
||||
item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable
|
||||
as PaymentProfileItemModel,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of PaymentProfileResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$PaymentProfileItemModelCopyWith<$Res> get item {
|
||||
|
||||
return $PaymentProfileItemModelCopyWith<$Res>(_self.item, (value) {
|
||||
return _then(_self.copyWith(item: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
mixin _$PaymentProfileItemModel {
|
||||
|
||||
String get id; String get userId; String get paymentProfileId; String? get jwt; int get bornAt; String get phone; List<PaymentProfileAddressModel> get taxResidences; List<PaymentProfileAddressModel> get addresses; String get status;//talk with Hector to change those names in the backend to be more consistent with the rest of the fields
|
||||
// ignore: non_constant_identifier_names
|
||||
String get KYCStatus;// ignore: non_constant_identifier_names
|
||||
String get KYCLevel; String get placeOfBirth; String get birthCountry; String get nationality; String get documentType; String get document; String? get paymentWalletId; int get createdAt;
|
||||
/// Create a copy of PaymentProfileItemModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$PaymentProfileItemModelCopyWith<PaymentProfileItemModel> get copyWith => _$PaymentProfileItemModelCopyWithImpl<PaymentProfileItemModel>(this as PaymentProfileItemModel, _$identity);
|
||||
|
||||
/// Serializes this PaymentProfileItemModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PaymentProfileItemModel&&(identical(other.id, id) || other.id == id)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.paymentProfileId, paymentProfileId) || other.paymentProfileId == paymentProfileId)&&(identical(other.jwt, jwt) || other.jwt == jwt)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other.taxResidences, taxResidences)&&const DeepCollectionEquality().equals(other.addresses, addresses)&&(identical(other.status, status) || other.status == status)&&(identical(other.KYCStatus, KYCStatus) || other.KYCStatus == KYCStatus)&&(identical(other.KYCLevel, KYCLevel) || other.KYCLevel == KYCLevel)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.nationality, nationality) || other.nationality == nationality)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.document, document) || other.document == document)&&(identical(other.paymentWalletId, paymentWalletId) || other.paymentWalletId == paymentWalletId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,userId,paymentProfileId,jwt,bornAt,phone,const DeepCollectionEquality().hash(taxResidences),const DeepCollectionEquality().hash(addresses),status,KYCStatus,KYCLevel,placeOfBirth,birthCountry,nationality,documentType,document,paymentWalletId,createdAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentProfileItemModel(id: $id, userId: $userId, paymentProfileId: $paymentProfileId, jwt: $jwt, bornAt: $bornAt, phone: $phone, taxResidences: $taxResidences, addresses: $addresses, status: $status, KYCStatus: $KYCStatus, KYCLevel: $KYCLevel, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, nationality: $nationality, documentType: $documentType, document: $document, paymentWalletId: $paymentWalletId, createdAt: $createdAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $PaymentProfileItemModelCopyWith<$Res> {
|
||||
factory $PaymentProfileItemModelCopyWith(PaymentProfileItemModel value, $Res Function(PaymentProfileItemModel) _then) = _$PaymentProfileItemModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String userId, String paymentProfileId, String? jwt, int bornAt, String phone, List<PaymentProfileAddressModel> taxResidences, List<PaymentProfileAddressModel> addresses, String status, String KYCStatus, String KYCLevel, String placeOfBirth, String birthCountry, String nationality, String documentType, String document, String? paymentWalletId, int createdAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$PaymentProfileItemModelCopyWithImpl<$Res>
|
||||
implements $PaymentProfileItemModelCopyWith<$Res> {
|
||||
_$PaymentProfileItemModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final PaymentProfileItemModel _self;
|
||||
final $Res Function(PaymentProfileItemModel) _then;
|
||||
|
||||
/// Create a copy of PaymentProfileItemModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? userId = null,Object? paymentProfileId = null,Object? jwt = freezed,Object? bornAt = null,Object? phone = null,Object? taxResidences = null,Object? addresses = null,Object? status = null,Object? KYCStatus = null,Object? KYCLevel = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? nationality = null,Object? documentType = null,Object? document = null,Object? paymentWalletId = freezed,Object? createdAt = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as String,paymentProfileId: null == paymentProfileId ? _self.paymentProfileId : paymentProfileId // ignore: cast_nullable_to_non_nullable
|
||||
as String,jwt: freezed == jwt ? _self.jwt : jwt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,bornAt: null == bornAt ? _self.bornAt : bornAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,taxResidences: null == taxResidences ? _self.taxResidences : taxResidences // ignore: cast_nullable_to_non_nullable
|
||||
as List<PaymentProfileAddressModel>,addresses: null == addresses ? _self.addresses : addresses // ignore: cast_nullable_to_non_nullable
|
||||
as List<PaymentProfileAddressModel>,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,KYCStatus: null == KYCStatus ? _self.KYCStatus : KYCStatus // ignore: cast_nullable_to_non_nullable
|
||||
as String,KYCLevel: null == KYCLevel ? _self.KYCLevel : KYCLevel // ignore: cast_nullable_to_non_nullable
|
||||
as String,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,nationality: null == nationality ? _self.nationality : nationality // ignore: cast_nullable_to_non_nullable
|
||||
as String,documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
|
||||
as String,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
|
||||
as String,paymentWalletId: freezed == paymentWalletId ? _self.paymentWalletId : paymentWalletId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [PaymentProfileItemModel].
|
||||
extension PaymentProfileItemModelPatterns on PaymentProfileItemModel {
|
||||
/// 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( _PaymentProfileItemModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileItemModel() 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( _PaymentProfileItemModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileItemModel():
|
||||
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( _PaymentProfileItemModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileItemModel() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String userId, String paymentProfileId, String? jwt, int bornAt, String phone, List<PaymentProfileAddressModel> taxResidences, List<PaymentProfileAddressModel> addresses, String status, String KYCStatus, String KYCLevel, String placeOfBirth, String birthCountry, String nationality, String documentType, String document, String? paymentWalletId, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileItemModel() when $default != null:
|
||||
return $default(_that.id,_that.userId,_that.paymentProfileId,_that.jwt,_that.bornAt,_that.phone,_that.taxResidences,_that.addresses,_that.status,_that.KYCStatus,_that.KYCLevel,_that.placeOfBirth,_that.birthCountry,_that.nationality,_that.documentType,_that.document,_that.paymentWalletId,_that.createdAt);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String userId, String paymentProfileId, String? jwt, int bornAt, String phone, List<PaymentProfileAddressModel> taxResidences, List<PaymentProfileAddressModel> addresses, String status, String KYCStatus, String KYCLevel, String placeOfBirth, String birthCountry, String nationality, String documentType, String document, String? paymentWalletId, int createdAt) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileItemModel():
|
||||
return $default(_that.id,_that.userId,_that.paymentProfileId,_that.jwt,_that.bornAt,_that.phone,_that.taxResidences,_that.addresses,_that.status,_that.KYCStatus,_that.KYCLevel,_that.placeOfBirth,_that.birthCountry,_that.nationality,_that.documentType,_that.document,_that.paymentWalletId,_that.createdAt);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String userId, String paymentProfileId, String? jwt, int bornAt, String phone, List<PaymentProfileAddressModel> taxResidences, List<PaymentProfileAddressModel> addresses, String status, String KYCStatus, String KYCLevel, String placeOfBirth, String birthCountry, String nationality, String documentType, String document, String? paymentWalletId, int createdAt)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileItemModel() when $default != null:
|
||||
return $default(_that.id,_that.userId,_that.paymentProfileId,_that.jwt,_that.bornAt,_that.phone,_that.taxResidences,_that.addresses,_that.status,_that.KYCStatus,_that.KYCLevel,_that.placeOfBirth,_that.birthCountry,_that.nationality,_that.documentType,_that.document,_that.paymentWalletId,_that.createdAt);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _PaymentProfileItemModel implements PaymentProfileItemModel {
|
||||
const _PaymentProfileItemModel({required this.id, required this.userId, required this.paymentProfileId, this.jwt, required this.bornAt, required this.phone, required final List<PaymentProfileAddressModel> taxResidences, required final List<PaymentProfileAddressModel> addresses, required this.status, required this.KYCStatus, required this.KYCLevel, required this.placeOfBirth, required this.birthCountry, required this.nationality, required this.documentType, required this.document, this.paymentWalletId, required this.createdAt}): _taxResidences = taxResidences,_addresses = addresses;
|
||||
factory _PaymentProfileItemModel.fromJson(Map<String, dynamic> json) => _$PaymentProfileItemModelFromJson(json);
|
||||
|
||||
@override final String id;
|
||||
@override final String userId;
|
||||
@override final String paymentProfileId;
|
||||
@override final String? jwt;
|
||||
@override final int bornAt;
|
||||
@override final String phone;
|
||||
final List<PaymentProfileAddressModel> _taxResidences;
|
||||
@override List<PaymentProfileAddressModel> get taxResidences {
|
||||
if (_taxResidences is EqualUnmodifiableListView) return _taxResidences;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_taxResidences);
|
||||
}
|
||||
|
||||
final List<PaymentProfileAddressModel> _addresses;
|
||||
@override List<PaymentProfileAddressModel> get addresses {
|
||||
if (_addresses is EqualUnmodifiableListView) return _addresses;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_addresses);
|
||||
}
|
||||
|
||||
@override final String status;
|
||||
//talk with Hector to change those names in the backend to be more consistent with the rest of the fields
|
||||
// ignore: non_constant_identifier_names
|
||||
@override final String KYCStatus;
|
||||
// ignore: non_constant_identifier_names
|
||||
@override final String KYCLevel;
|
||||
@override final String placeOfBirth;
|
||||
@override final String birthCountry;
|
||||
@override final String nationality;
|
||||
@override final String documentType;
|
||||
@override final String document;
|
||||
@override final String? paymentWalletId;
|
||||
@override final int createdAt;
|
||||
|
||||
/// Create a copy of PaymentProfileItemModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$PaymentProfileItemModelCopyWith<_PaymentProfileItemModel> get copyWith => __$PaymentProfileItemModelCopyWithImpl<_PaymentProfileItemModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$PaymentProfileItemModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PaymentProfileItemModel&&(identical(other.id, id) || other.id == id)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.paymentProfileId, paymentProfileId) || other.paymentProfileId == paymentProfileId)&&(identical(other.jwt, jwt) || other.jwt == jwt)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other._taxResidences, _taxResidences)&&const DeepCollectionEquality().equals(other._addresses, _addresses)&&(identical(other.status, status) || other.status == status)&&(identical(other.KYCStatus, KYCStatus) || other.KYCStatus == KYCStatus)&&(identical(other.KYCLevel, KYCLevel) || other.KYCLevel == KYCLevel)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.nationality, nationality) || other.nationality == nationality)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.document, document) || other.document == document)&&(identical(other.paymentWalletId, paymentWalletId) || other.paymentWalletId == paymentWalletId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,userId,paymentProfileId,jwt,bornAt,phone,const DeepCollectionEquality().hash(_taxResidences),const DeepCollectionEquality().hash(_addresses),status,KYCStatus,KYCLevel,placeOfBirth,birthCountry,nationality,documentType,document,paymentWalletId,createdAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentProfileItemModel(id: $id, userId: $userId, paymentProfileId: $paymentProfileId, jwt: $jwt, bornAt: $bornAt, phone: $phone, taxResidences: $taxResidences, addresses: $addresses, status: $status, KYCStatus: $KYCStatus, KYCLevel: $KYCLevel, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, nationality: $nationality, documentType: $documentType, document: $document, paymentWalletId: $paymentWalletId, createdAt: $createdAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$PaymentProfileItemModelCopyWith<$Res> implements $PaymentProfileItemModelCopyWith<$Res> {
|
||||
factory _$PaymentProfileItemModelCopyWith(_PaymentProfileItemModel value, $Res Function(_PaymentProfileItemModel) _then) = __$PaymentProfileItemModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String userId, String paymentProfileId, String? jwt, int bornAt, String phone, List<PaymentProfileAddressModel> taxResidences, List<PaymentProfileAddressModel> addresses, String status, String KYCStatus, String KYCLevel, String placeOfBirth, String birthCountry, String nationality, String documentType, String document, String? paymentWalletId, int createdAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$PaymentProfileItemModelCopyWithImpl<$Res>
|
||||
implements _$PaymentProfileItemModelCopyWith<$Res> {
|
||||
__$PaymentProfileItemModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _PaymentProfileItemModel _self;
|
||||
final $Res Function(_PaymentProfileItemModel) _then;
|
||||
|
||||
/// Create a copy of PaymentProfileItemModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? userId = null,Object? paymentProfileId = null,Object? jwt = freezed,Object? bornAt = null,Object? phone = null,Object? taxResidences = null,Object? addresses = null,Object? status = null,Object? KYCStatus = null,Object? KYCLevel = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? nationality = null,Object? documentType = null,Object? document = null,Object? paymentWalletId = freezed,Object? createdAt = null,}) {
|
||||
return _then(_PaymentProfileItemModel(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as String,paymentProfileId: null == paymentProfileId ? _self.paymentProfileId : paymentProfileId // ignore: cast_nullable_to_non_nullable
|
||||
as String,jwt: freezed == jwt ? _self.jwt : jwt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,bornAt: null == bornAt ? _self.bornAt : bornAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,taxResidences: null == taxResidences ? _self._taxResidences : taxResidences // ignore: cast_nullable_to_non_nullable
|
||||
as List<PaymentProfileAddressModel>,addresses: null == addresses ? _self._addresses : addresses // ignore: cast_nullable_to_non_nullable
|
||||
as List<PaymentProfileAddressModel>,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,KYCStatus: null == KYCStatus ? _self.KYCStatus : KYCStatus // ignore: cast_nullable_to_non_nullable
|
||||
as String,KYCLevel: null == KYCLevel ? _self.KYCLevel : KYCLevel // ignore: cast_nullable_to_non_nullable
|
||||
as String,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,nationality: null == nationality ? _self.nationality : nationality // ignore: cast_nullable_to_non_nullable
|
||||
as String,documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
|
||||
as String,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
|
||||
as String,paymentWalletId: freezed == paymentWalletId ? _self.paymentWalletId : paymentWalletId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
mixin _$PaymentProfileAddressModel {
|
||||
|
||||
String get street; String get city; String get province; String get state; String get country; int get postCode;
|
||||
/// Create a copy of PaymentProfileAddressModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$PaymentProfileAddressModelCopyWith<PaymentProfileAddressModel> get copyWith => _$PaymentProfileAddressModelCopyWithImpl<PaymentProfileAddressModel>(this as PaymentProfileAddressModel, _$identity);
|
||||
|
||||
/// Serializes this PaymentProfileAddressModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PaymentProfileAddressModel&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)&&(identical(other.postCode, postCode) || other.postCode == postCode));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,street,city,province,state,country,postCode);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentProfileAddressModel(street: $street, city: $city, province: $province, state: $state, country: $country, postCode: $postCode)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $PaymentProfileAddressModelCopyWith<$Res> {
|
||||
factory $PaymentProfileAddressModelCopyWith(PaymentProfileAddressModel value, $Res Function(PaymentProfileAddressModel) _then) = _$PaymentProfileAddressModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String street, String city, String province, String state, String country, int postCode
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$PaymentProfileAddressModelCopyWithImpl<$Res>
|
||||
implements $PaymentProfileAddressModelCopyWith<$Res> {
|
||||
_$PaymentProfileAddressModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final PaymentProfileAddressModel _self;
|
||||
final $Res Function(PaymentProfileAddressModel) _then;
|
||||
|
||||
/// Create a copy of PaymentProfileAddressModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,Object? postCode = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
|
||||
as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
|
||||
as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
|
||||
as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
|
||||
as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
|
||||
as String,postCode: null == postCode ? _self.postCode : postCode // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [PaymentProfileAddressModel].
|
||||
extension PaymentProfileAddressModelPatterns on PaymentProfileAddressModel {
|
||||
/// 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( _PaymentProfileAddressModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileAddressModel() 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( _PaymentProfileAddressModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileAddressModel():
|
||||
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( _PaymentProfileAddressModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileAddressModel() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String street, String city, String province, String state, String country, int postCode)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileAddressModel() when $default != null:
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.postCode);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String street, String city, String province, String state, String country, int postCode) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileAddressModel():
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.postCode);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String street, String city, String province, String state, String country, int postCode)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileAddressModel() when $default != null:
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.postCode);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _PaymentProfileAddressModel implements PaymentProfileAddressModel {
|
||||
const _PaymentProfileAddressModel({required this.street, required this.city, required this.province, required this.state, required this.country, required this.postCode});
|
||||
factory _PaymentProfileAddressModel.fromJson(Map<String, dynamic> json) => _$PaymentProfileAddressModelFromJson(json);
|
||||
|
||||
@override final String street;
|
||||
@override final String city;
|
||||
@override final String province;
|
||||
@override final String state;
|
||||
@override final String country;
|
||||
@override final int postCode;
|
||||
|
||||
/// Create a copy of PaymentProfileAddressModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$PaymentProfileAddressModelCopyWith<_PaymentProfileAddressModel> get copyWith => __$PaymentProfileAddressModelCopyWithImpl<_PaymentProfileAddressModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$PaymentProfileAddressModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PaymentProfileAddressModel&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)&&(identical(other.postCode, postCode) || other.postCode == postCode));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,street,city,province,state,country,postCode);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentProfileAddressModel(street: $street, city: $city, province: $province, state: $state, country: $country, postCode: $postCode)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$PaymentProfileAddressModelCopyWith<$Res> implements $PaymentProfileAddressModelCopyWith<$Res> {
|
||||
factory _$PaymentProfileAddressModelCopyWith(_PaymentProfileAddressModel value, $Res Function(_PaymentProfileAddressModel) _then) = __$PaymentProfileAddressModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String street, String city, String province, String state, String country, int postCode
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$PaymentProfileAddressModelCopyWithImpl<$Res>
|
||||
implements _$PaymentProfileAddressModelCopyWith<$Res> {
|
||||
__$PaymentProfileAddressModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _PaymentProfileAddressModel _self;
|
||||
final $Res Function(_PaymentProfileAddressModel) _then;
|
||||
|
||||
/// Create a copy of PaymentProfileAddressModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,Object? postCode = null,}) {
|
||||
return _then(_PaymentProfileAddressModel(
|
||||
street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
|
||||
as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
|
||||
as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
|
||||
as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
|
||||
as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
|
||||
as String,postCode: null == postCode ? _self.postCode : postCode // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,93 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'payment_profile_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_PaymentProfileResponseModel _$PaymentProfileResponseModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _PaymentProfileResponseModel(
|
||||
item: PaymentProfileItemModel.fromJson(json['item'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$PaymentProfileResponseModelToJson(
|
||||
_PaymentProfileResponseModel instance,
|
||||
) => <String, dynamic>{'item': instance.item};
|
||||
|
||||
_PaymentProfileItemModel _$PaymentProfileItemModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _PaymentProfileItemModel(
|
||||
id: json['id'] as String,
|
||||
userId: json['userId'] as String,
|
||||
paymentProfileId: json['paymentProfileId'] as String,
|
||||
jwt: json['jwt'] as String?,
|
||||
bornAt: (json['bornAt'] as num).toInt(),
|
||||
phone: json['phone'] as String,
|
||||
taxResidences: (json['taxResidences'] as List<dynamic>)
|
||||
.map(
|
||||
(e) => PaymentProfileAddressModel.fromJson(e as Map<String, dynamic>),
|
||||
)
|
||||
.toList(),
|
||||
addresses: (json['addresses'] as List<dynamic>)
|
||||
.map(
|
||||
(e) => PaymentProfileAddressModel.fromJson(e as Map<String, dynamic>),
|
||||
)
|
||||
.toList(),
|
||||
status: json['status'] as String,
|
||||
KYCStatus: json['KYCStatus'] as String,
|
||||
KYCLevel: json['KYCLevel'] as String,
|
||||
placeOfBirth: json['placeOfBirth'] as String,
|
||||
birthCountry: json['birthCountry'] as String,
|
||||
nationality: json['nationality'] as String,
|
||||
documentType: json['documentType'] as String,
|
||||
document: json['document'] as String,
|
||||
paymentWalletId: json['paymentWalletId'] as String?,
|
||||
createdAt: (json['createdAt'] as num).toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$PaymentProfileItemModelToJson(
|
||||
_PaymentProfileItemModel instance,
|
||||
) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'userId': instance.userId,
|
||||
'paymentProfileId': instance.paymentProfileId,
|
||||
'jwt': instance.jwt,
|
||||
'bornAt': instance.bornAt,
|
||||
'phone': instance.phone,
|
||||
'taxResidences': instance.taxResidences,
|
||||
'addresses': instance.addresses,
|
||||
'status': instance.status,
|
||||
'KYCStatus': instance.KYCStatus,
|
||||
'KYCLevel': instance.KYCLevel,
|
||||
'placeOfBirth': instance.placeOfBirth,
|
||||
'birthCountry': instance.birthCountry,
|
||||
'nationality': instance.nationality,
|
||||
'documentType': instance.documentType,
|
||||
'document': instance.document,
|
||||
'paymentWalletId': instance.paymentWalletId,
|
||||
'createdAt': instance.createdAt,
|
||||
};
|
||||
|
||||
_PaymentProfileAddressModel _$PaymentProfileAddressModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _PaymentProfileAddressModel(
|
||||
street: json['street'] as String,
|
||||
city: json['city'] as String,
|
||||
province: json['province'] as String,
|
||||
state: json['state'] as String,
|
||||
country: json['country'] as String,
|
||||
postCode: (json['postCode'] as num).toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$PaymentProfileAddressModelToJson(
|
||||
_PaymentProfileAddressModel instance,
|
||||
) => <String, dynamic>{
|
||||
'street': instance.street,
|
||||
'city': instance.city,
|
||||
'province': instance.province,
|
||||
'state': instance.state,
|
||||
'country': instance.country,
|
||||
'postCode': instance.postCode,
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'user_response_model.freezed.dart';
|
||||
part 'user_response_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class UserResponseModel with _$UserResponseModel {
|
||||
const factory UserResponseModel({required UserModel item}) =
|
||||
_UserResponseModel;
|
||||
|
||||
factory UserResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$UserResponseModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class UserModel with _$UserModel {
|
||||
const factory UserModel({
|
||||
required String id,
|
||||
String? delegationId,
|
||||
required String email,
|
||||
required int createdAt,
|
||||
int? updatedAt,
|
||||
required String status,
|
||||
required String role,
|
||||
required int lastLogin,
|
||||
required int currentLogin,
|
||||
required String language,
|
||||
required String firstName,
|
||||
required String lastName,
|
||||
required bool hasApiKey,
|
||||
required String phone,
|
||||
}) = _UserModel;
|
||||
|
||||
factory UserModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$UserModelFromJson(json);
|
||||
}
|
||||
@@ -1,597 +0,0 @@
|
||||
// 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 'user_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UserResponseModel {
|
||||
|
||||
UserModel get item;
|
||||
/// Create a copy of UserResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$UserResponseModelCopyWith<UserResponseModel> get copyWith => _$UserResponseModelCopyWithImpl<UserResponseModel>(this as UserResponseModel, _$identity);
|
||||
|
||||
/// Serializes this UserResponseModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is UserResponseModel&&(identical(other.item, item) || other.item == item));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,item);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserResponseModel(item: $item)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $UserResponseModelCopyWith<$Res> {
|
||||
factory $UserResponseModelCopyWith(UserResponseModel value, $Res Function(UserResponseModel) _then) = _$UserResponseModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
UserModel item
|
||||
});
|
||||
|
||||
|
||||
$UserModelCopyWith<$Res> get item;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$UserResponseModelCopyWithImpl<$Res>
|
||||
implements $UserResponseModelCopyWith<$Res> {
|
||||
_$UserResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final UserResponseModel _self;
|
||||
final $Res Function(UserResponseModel) _then;
|
||||
|
||||
/// Create a copy of UserResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? item = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable
|
||||
as UserModel,
|
||||
));
|
||||
}
|
||||
/// Create a copy of UserResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$UserModelCopyWith<$Res> get item {
|
||||
|
||||
return $UserModelCopyWith<$Res>(_self.item, (value) {
|
||||
return _then(_self.copyWith(item: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [UserResponseModel].
|
||||
extension UserResponseModelPatterns on UserResponseModel {
|
||||
/// 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( _UserResponseModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserResponseModel() 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( _UserResponseModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserResponseModel():
|
||||
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( _UserResponseModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserResponseModel() 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( UserModel item)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserResponseModel() when $default != null:
|
||||
return $default(_that.item);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( UserModel item) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserResponseModel():
|
||||
return $default(_that.item);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( UserModel item)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserResponseModel() when $default != null:
|
||||
return $default(_that.item);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _UserResponseModel implements UserResponseModel {
|
||||
const _UserResponseModel({required this.item});
|
||||
factory _UserResponseModel.fromJson(Map<String, dynamic> json) => _$UserResponseModelFromJson(json);
|
||||
|
||||
@override final UserModel item;
|
||||
|
||||
/// Create a copy of UserResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$UserResponseModelCopyWith<_UserResponseModel> get copyWith => __$UserResponseModelCopyWithImpl<_UserResponseModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$UserResponseModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UserResponseModel&&(identical(other.item, item) || other.item == item));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,item);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserResponseModel(item: $item)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$UserResponseModelCopyWith<$Res> implements $UserResponseModelCopyWith<$Res> {
|
||||
factory _$UserResponseModelCopyWith(_UserResponseModel value, $Res Function(_UserResponseModel) _then) = __$UserResponseModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
UserModel item
|
||||
});
|
||||
|
||||
|
||||
@override $UserModelCopyWith<$Res> get item;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$UserResponseModelCopyWithImpl<$Res>
|
||||
implements _$UserResponseModelCopyWith<$Res> {
|
||||
__$UserResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _UserResponseModel _self;
|
||||
final $Res Function(_UserResponseModel) _then;
|
||||
|
||||
/// Create a copy of UserResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? item = null,}) {
|
||||
return _then(_UserResponseModel(
|
||||
item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable
|
||||
as UserModel,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of UserResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$UserModelCopyWith<$Res> get item {
|
||||
|
||||
return $UserModelCopyWith<$Res>(_self.item, (value) {
|
||||
return _then(_self.copyWith(item: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UserModel {
|
||||
|
||||
String get id; String? get delegationId; String get email; int get createdAt; int? get updatedAt; String get status; String get role; int get lastLogin; int get currentLogin; String get language; String get firstName; String get lastName; bool get hasApiKey; String get phone;
|
||||
/// Create a copy of UserModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$UserModelCopyWith<UserModel> get copyWith => _$UserModelCopyWithImpl<UserModel>(this as UserModel, _$identity);
|
||||
|
||||
/// Serializes this UserModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is UserModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $UserModelCopyWith<$Res> {
|
||||
factory $UserModelCopyWith(UserModel value, $Res Function(UserModel) _then) = _$UserModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String? delegationId, String email, int createdAt, int? updatedAt, String status, String role, int lastLogin, int currentLogin, String language, String firstName, String lastName, bool hasApiKey, String phone
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$UserModelCopyWithImpl<$Res>
|
||||
implements $UserModelCopyWith<$Res> {
|
||||
_$UserModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final UserModel _self;
|
||||
final $Res Function(UserModel) _then;
|
||||
|
||||
/// Create a copy of UserModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = freezed,Object? email = null,Object? createdAt = null,Object? updatedAt = freezed,Object? status = null,Object? role = null,Object? lastLogin = null,Object? currentLogin = null,Object? language = null,Object? firstName = null,Object? lastName = null,Object? hasApiKey = null,Object? phone = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as int?,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,role: null == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
|
||||
as String,lastLogin: null == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
|
||||
as int,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
|
||||
as int,language: null == language ? _self.language : language // 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,hasApiKey: null == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
|
||||
as bool,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [UserModel].
|
||||
extension UserModelPatterns on UserModel {
|
||||
/// 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( _UserModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserModel() 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( _UserModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserModel():
|
||||
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( _UserModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserModel() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String? delegationId, String email, int createdAt, int? updatedAt, String status, String role, int lastLogin, int currentLogin, String language, String firstName, String lastName, bool hasApiKey, String phone)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserModel() when $default != null:
|
||||
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String? delegationId, String email, int createdAt, int? updatedAt, String status, String role, int lastLogin, int currentLogin, String language, String firstName, String lastName, bool hasApiKey, String phone) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserModel():
|
||||
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String? delegationId, String email, int createdAt, int? updatedAt, String status, String role, int lastLogin, int currentLogin, String language, String firstName, String lastName, bool hasApiKey, String phone)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserModel() when $default != null:
|
||||
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _UserModel implements UserModel {
|
||||
const _UserModel({required this.id, this.delegationId, required this.email, required this.createdAt, this.updatedAt, required this.status, required this.role, required this.lastLogin, required this.currentLogin, required this.language, required this.firstName, required this.lastName, required this.hasApiKey, required this.phone});
|
||||
factory _UserModel.fromJson(Map<String, dynamic> json) => _$UserModelFromJson(json);
|
||||
|
||||
@override final String id;
|
||||
@override final String? delegationId;
|
||||
@override final String email;
|
||||
@override final int createdAt;
|
||||
@override final int? updatedAt;
|
||||
@override final String status;
|
||||
@override final String role;
|
||||
@override final int lastLogin;
|
||||
@override final int currentLogin;
|
||||
@override final String language;
|
||||
@override final String firstName;
|
||||
@override final String lastName;
|
||||
@override final bool hasApiKey;
|
||||
@override final String phone;
|
||||
|
||||
/// Create a copy of UserModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$UserModelCopyWith<_UserModel> get copyWith => __$UserModelCopyWithImpl<_UserModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$UserModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UserModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$UserModelCopyWith<$Res> implements $UserModelCopyWith<$Res> {
|
||||
factory _$UserModelCopyWith(_UserModel value, $Res Function(_UserModel) _then) = __$UserModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String? delegationId, String email, int createdAt, int? updatedAt, String status, String role, int lastLogin, int currentLogin, String language, String firstName, String lastName, bool hasApiKey, String phone
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$UserModelCopyWithImpl<$Res>
|
||||
implements _$UserModelCopyWith<$Res> {
|
||||
__$UserModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _UserModel _self;
|
||||
final $Res Function(_UserModel) _then;
|
||||
|
||||
/// Create a copy of UserModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = freezed,Object? email = null,Object? createdAt = null,Object? updatedAt = freezed,Object? status = null,Object? role = null,Object? lastLogin = null,Object? currentLogin = null,Object? language = null,Object? firstName = null,Object? lastName = null,Object? hasApiKey = null,Object? phone = null,}) {
|
||||
return _then(_UserModel(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as int?,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,role: null == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
|
||||
as String,lastLogin: null == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
|
||||
as int,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
|
||||
as int,language: null == language ? _self.language : language // 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,hasApiKey: null == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
|
||||
as bool,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,50 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'user_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_UserResponseModel _$UserResponseModelFromJson(Map<String, dynamic> json) =>
|
||||
_UserResponseModel(
|
||||
item: UserModel.fromJson(json['item'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$UserResponseModelToJson(_UserResponseModel instance) =>
|
||||
<String, dynamic>{'item': instance.item};
|
||||
|
||||
_UserModel _$UserModelFromJson(Map<String, dynamic> json) => _UserModel(
|
||||
id: json['id'] as String,
|
||||
delegationId: json['delegationId'] as String?,
|
||||
email: json['email'] as String,
|
||||
createdAt: (json['createdAt'] as num).toInt(),
|
||||
updatedAt: (json['updatedAt'] as num?)?.toInt(),
|
||||
status: json['status'] as String,
|
||||
role: json['role'] as String,
|
||||
lastLogin: (json['lastLogin'] as num).toInt(),
|
||||
currentLogin: (json['currentLogin'] as num).toInt(),
|
||||
language: json['language'] as String,
|
||||
firstName: json['firstName'] as String,
|
||||
lastName: json['lastName'] as String,
|
||||
hasApiKey: json['hasApiKey'] as bool,
|
||||
phone: json['phone'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$UserModelToJson(_UserModel instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'delegationId': instance.delegationId,
|
||||
'email': instance.email,
|
||||
'createdAt': instance.createdAt,
|
||||
'updatedAt': instance.updatedAt,
|
||||
'status': instance.status,
|
||||
'role': instance.role,
|
||||
'lastLogin': instance.lastLogin,
|
||||
'currentLogin': instance.currentLogin,
|
||||
'language': instance.language,
|
||||
'firstName': instance.firstName,
|
||||
'lastName': instance.lastName,
|
||||
'hasApiKey': instance.hasApiKey,
|
||||
'phone': instance.phone,
|
||||
};
|
||||
@@ -1,15 +1,11 @@
|
||||
import 'package:auth/src/core/data/datasource/auth_remote_datasource.dart';
|
||||
import 'package:auth/src/core/data/mappers/user_model_mapper.dart';
|
||||
import 'package:auth/src/core/data/models/child_profile_response_model.dart';
|
||||
import 'package:auth/src/core/data/models/payment_profile_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/core/domain/repositories/auth_repository.dart';
|
||||
import 'package:auth/src/features/device_setup/domain/entities/child_profile_entity.dart';
|
||||
import 'package:auth/src/features/login/domain/entities/login_response_entity.dart';
|
||||
import 'package:auth/src/features/login/domain/entities/payment_profile_entity.dart';
|
||||
import 'package:auth/src/features/login/domain/entities/user_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/core/data/models/login_response_model.dart';
|
||||
@@ -60,25 +56,11 @@ class AuthRepositoryImpl implements AuthRepository {
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<UserEntity> getUserInfo() async {
|
||||
final model = await _remote.getUserInfo();
|
||||
return model.toEntity();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> createWallet() {
|
||||
return _remote.createWallet();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<PaymentProfileEntity> getPaymentProfile({
|
||||
required String userId,
|
||||
}) async {
|
||||
final model = await _remote.getPaymentProfile(userId: userId);
|
||||
return model.toEntity();
|
||||
}
|
||||
|
||||
// @override
|
||||
// Future<String> totpLogin({required String token, required String code}) {
|
||||
// return _remote.totpLogin(token: token, code: code);
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import 'package:auth/src/core/data/models/child_profile_response_model.dart';
|
||||
import 'package:auth/src/core/data/models/two_fa_secret_response_model.dart';
|
||||
import 'package:auth/src/features/device_setup/domain/entities/child_profile_entity.dart';
|
||||
import 'package:auth/src/features/login/domain/entities/login_response_entity.dart';
|
||||
import 'package:auth/src/features/login/domain/entities/payment_profile_entity.dart';
|
||||
import 'package:auth/src/features/login/domain/entities/user_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';
|
||||
|
||||
@@ -25,12 +22,9 @@ abstract class AuthRepository {
|
||||
required String code,
|
||||
required String methodType,
|
||||
});
|
||||
Future<UserEntity> getUserInfo();
|
||||
|
||||
Future<void> createWallet();
|
||||
|
||||
Future<PaymentProfileEntity> getPaymentProfile({required String userId});
|
||||
|
||||
// Future<String> totpLogin({required String token, required String code});
|
||||
|
||||
Future<SignUpResponseEntity> signUp({required SignUpRequestEntity request});
|
||||
|
||||
@@ -5,14 +5,12 @@ import 'package:auth/src/features/device_setup/presentation/enums/scan_link_step
|
||||
import 'package:auth/src/features/device_setup/presentation/providers/create_child_profile_use_case_provider.dart';
|
||||
import 'package:auth/src/features/device_setup/presentation/state/device_setup_view_state.dart';
|
||||
import 'package:auth/src/features/device_setup/presentation/enums/add_kid_step.dart';
|
||||
import 'package:auth/src/features/login/domain/entities/user_entity.dart';
|
||||
import 'package:auth/src/features/login/domain/get_me_user_use_case.dart';
|
||||
import 'package:auth/src/features/login/presentation/providers/get_user_info_provider.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:sca_treezor/sca_treezor.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
final deviceSetupViewModelProvider =
|
||||
@@ -80,9 +78,7 @@ class DeviceSetupViewModel extends Notifier<DeviceSetupViewState> {
|
||||
case AddKidStep.scanStrap:
|
||||
final hasStrap = state.strapQr.isNotEmpty || state.strapCode.isNotEmpty;
|
||||
if (!hasStrap) {
|
||||
state = state.copyWith(
|
||||
errorMessage: I18n.errorScanStrapRequired,
|
||||
);
|
||||
state = state.copyWith(errorMessage: I18n.errorScanStrapRequired);
|
||||
return;
|
||||
}
|
||||
state = state.copyWith(step: AddKidStep.scanWatch, errorMessage: '');
|
||||
@@ -90,9 +86,7 @@ class DeviceSetupViewModel extends Notifier<DeviceSetupViewState> {
|
||||
case AddKidStep.scanWatch:
|
||||
final hasWatch = state.watchQr.isNotEmpty || state.watchCode.isNotEmpty;
|
||||
if (!hasWatch) {
|
||||
state = state.copyWith(
|
||||
errorMessage: I18n.errorScanWatchRequired,
|
||||
);
|
||||
state = state.copyWith(errorMessage: I18n.errorScanWatchRequired);
|
||||
return;
|
||||
}
|
||||
state = state.copyWith(step: AddKidStep.profile, errorMessage: '');
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'payment_profile_entity.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class PaymentProfileEntity with _$PaymentProfileEntity {
|
||||
const factory PaymentProfileEntity({
|
||||
required String id,
|
||||
required String userId,
|
||||
required String paymentProfileId,
|
||||
String? jwt,
|
||||
required int bornAt,
|
||||
required String phone,
|
||||
required List<PaymentProfileAddressEntity> taxResidences,
|
||||
required List<PaymentProfileAddressEntity> addresses,
|
||||
required String status,
|
||||
required String kycStatus,
|
||||
required String kycLevel,
|
||||
required String placeOfBirth,
|
||||
required String birthCountry,
|
||||
required String nationality,
|
||||
required String documentType,
|
||||
required String document,
|
||||
String? paymentWalletId,
|
||||
required int createdAt,
|
||||
}) = _PaymentProfileEntity;
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class PaymentProfileAddressEntity
|
||||
with _$PaymentProfileAddressEntity {
|
||||
const factory PaymentProfileAddressEntity({
|
||||
required String street,
|
||||
required String city,
|
||||
required String province,
|
||||
required String state,
|
||||
required String country,
|
||||
required int postCode,
|
||||
}) = _PaymentProfileAddressEntity;
|
||||
}
|
||||
@@ -1,606 +0,0 @@
|
||||
// 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 'payment_profile_entity.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$PaymentProfileEntity {
|
||||
|
||||
String get id; String get userId; String get paymentProfileId; String? get jwt; int get bornAt; String get phone; List<PaymentProfileAddressEntity> get taxResidences; List<PaymentProfileAddressEntity> get addresses; String get status; String get kycStatus; String get kycLevel; String get placeOfBirth; String get birthCountry; String get nationality; String get documentType; String get document; String? get paymentWalletId; int get createdAt;
|
||||
/// Create a copy of PaymentProfileEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$PaymentProfileEntityCopyWith<PaymentProfileEntity> get copyWith => _$PaymentProfileEntityCopyWithImpl<PaymentProfileEntity>(this as PaymentProfileEntity, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PaymentProfileEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.paymentProfileId, paymentProfileId) || other.paymentProfileId == paymentProfileId)&&(identical(other.jwt, jwt) || other.jwt == jwt)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other.taxResidences, taxResidences)&&const DeepCollectionEquality().equals(other.addresses, addresses)&&(identical(other.status, status) || other.status == status)&&(identical(other.kycStatus, kycStatus) || other.kycStatus == kycStatus)&&(identical(other.kycLevel, kycLevel) || other.kycLevel == kycLevel)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.nationality, nationality) || other.nationality == nationality)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.document, document) || other.document == document)&&(identical(other.paymentWalletId, paymentWalletId) || other.paymentWalletId == paymentWalletId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,userId,paymentProfileId,jwt,bornAt,phone,const DeepCollectionEquality().hash(taxResidences),const DeepCollectionEquality().hash(addresses),status,kycStatus,kycLevel,placeOfBirth,birthCountry,nationality,documentType,document,paymentWalletId,createdAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentProfileEntity(id: $id, userId: $userId, paymentProfileId: $paymentProfileId, jwt: $jwt, bornAt: $bornAt, phone: $phone, taxResidences: $taxResidences, addresses: $addresses, status: $status, kycStatus: $kycStatus, kycLevel: $kycLevel, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, nationality: $nationality, documentType: $documentType, document: $document, paymentWalletId: $paymentWalletId, createdAt: $createdAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $PaymentProfileEntityCopyWith<$Res> {
|
||||
factory $PaymentProfileEntityCopyWith(PaymentProfileEntity value, $Res Function(PaymentProfileEntity) _then) = _$PaymentProfileEntityCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String userId, String paymentProfileId, String? jwt, int bornAt, String phone, List<PaymentProfileAddressEntity> taxResidences, List<PaymentProfileAddressEntity> addresses, String status, String kycStatus, String kycLevel, String placeOfBirth, String birthCountry, String nationality, String documentType, String document, String? paymentWalletId, int createdAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$PaymentProfileEntityCopyWithImpl<$Res>
|
||||
implements $PaymentProfileEntityCopyWith<$Res> {
|
||||
_$PaymentProfileEntityCopyWithImpl(this._self, this._then);
|
||||
|
||||
final PaymentProfileEntity _self;
|
||||
final $Res Function(PaymentProfileEntity) _then;
|
||||
|
||||
/// Create a copy of PaymentProfileEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? userId = null,Object? paymentProfileId = null,Object? jwt = freezed,Object? bornAt = null,Object? phone = null,Object? taxResidences = null,Object? addresses = null,Object? status = null,Object? kycStatus = null,Object? kycLevel = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? nationality = null,Object? documentType = null,Object? document = null,Object? paymentWalletId = freezed,Object? createdAt = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as String,paymentProfileId: null == paymentProfileId ? _self.paymentProfileId : paymentProfileId // ignore: cast_nullable_to_non_nullable
|
||||
as String,jwt: freezed == jwt ? _self.jwt : jwt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,bornAt: null == bornAt ? _self.bornAt : bornAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,taxResidences: null == taxResidences ? _self.taxResidences : taxResidences // ignore: cast_nullable_to_non_nullable
|
||||
as List<PaymentProfileAddressEntity>,addresses: null == addresses ? _self.addresses : addresses // ignore: cast_nullable_to_non_nullable
|
||||
as List<PaymentProfileAddressEntity>,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,kycStatus: null == kycStatus ? _self.kycStatus : kycStatus // ignore: cast_nullable_to_non_nullable
|
||||
as String,kycLevel: null == kycLevel ? _self.kycLevel : kycLevel // ignore: cast_nullable_to_non_nullable
|
||||
as String,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,nationality: null == nationality ? _self.nationality : nationality // ignore: cast_nullable_to_non_nullable
|
||||
as String,documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
|
||||
as String,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
|
||||
as String,paymentWalletId: freezed == paymentWalletId ? _self.paymentWalletId : paymentWalletId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [PaymentProfileEntity].
|
||||
extension PaymentProfileEntityPatterns on PaymentProfileEntity {
|
||||
/// 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( _PaymentProfileEntity value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileEntity() 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( _PaymentProfileEntity value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileEntity():
|
||||
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( _PaymentProfileEntity value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileEntity() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String userId, String paymentProfileId, String? jwt, int bornAt, String phone, List<PaymentProfileAddressEntity> taxResidences, List<PaymentProfileAddressEntity> addresses, String status, String kycStatus, String kycLevel, String placeOfBirth, String birthCountry, String nationality, String documentType, String document, String? paymentWalletId, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileEntity() when $default != null:
|
||||
return $default(_that.id,_that.userId,_that.paymentProfileId,_that.jwt,_that.bornAt,_that.phone,_that.taxResidences,_that.addresses,_that.status,_that.kycStatus,_that.kycLevel,_that.placeOfBirth,_that.birthCountry,_that.nationality,_that.documentType,_that.document,_that.paymentWalletId,_that.createdAt);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String userId, String paymentProfileId, String? jwt, int bornAt, String phone, List<PaymentProfileAddressEntity> taxResidences, List<PaymentProfileAddressEntity> addresses, String status, String kycStatus, String kycLevel, String placeOfBirth, String birthCountry, String nationality, String documentType, String document, String? paymentWalletId, int createdAt) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileEntity():
|
||||
return $default(_that.id,_that.userId,_that.paymentProfileId,_that.jwt,_that.bornAt,_that.phone,_that.taxResidences,_that.addresses,_that.status,_that.kycStatus,_that.kycLevel,_that.placeOfBirth,_that.birthCountry,_that.nationality,_that.documentType,_that.document,_that.paymentWalletId,_that.createdAt);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String userId, String paymentProfileId, String? jwt, int bornAt, String phone, List<PaymentProfileAddressEntity> taxResidences, List<PaymentProfileAddressEntity> addresses, String status, String kycStatus, String kycLevel, String placeOfBirth, String birthCountry, String nationality, String documentType, String document, String? paymentWalletId, int createdAt)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileEntity() when $default != null:
|
||||
return $default(_that.id,_that.userId,_that.paymentProfileId,_that.jwt,_that.bornAt,_that.phone,_that.taxResidences,_that.addresses,_that.status,_that.kycStatus,_that.kycLevel,_that.placeOfBirth,_that.birthCountry,_that.nationality,_that.documentType,_that.document,_that.paymentWalletId,_that.createdAt);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _PaymentProfileEntity implements PaymentProfileEntity {
|
||||
const _PaymentProfileEntity({required this.id, required this.userId, required this.paymentProfileId, this.jwt, required this.bornAt, required this.phone, required final List<PaymentProfileAddressEntity> taxResidences, required final List<PaymentProfileAddressEntity> addresses, required this.status, required this.kycStatus, required this.kycLevel, required this.placeOfBirth, required this.birthCountry, required this.nationality, required this.documentType, required this.document, this.paymentWalletId, required this.createdAt}): _taxResidences = taxResidences,_addresses = addresses;
|
||||
|
||||
|
||||
@override final String id;
|
||||
@override final String userId;
|
||||
@override final String paymentProfileId;
|
||||
@override final String? jwt;
|
||||
@override final int bornAt;
|
||||
@override final String phone;
|
||||
final List<PaymentProfileAddressEntity> _taxResidences;
|
||||
@override List<PaymentProfileAddressEntity> get taxResidences {
|
||||
if (_taxResidences is EqualUnmodifiableListView) return _taxResidences;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_taxResidences);
|
||||
}
|
||||
|
||||
final List<PaymentProfileAddressEntity> _addresses;
|
||||
@override List<PaymentProfileAddressEntity> get addresses {
|
||||
if (_addresses is EqualUnmodifiableListView) return _addresses;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_addresses);
|
||||
}
|
||||
|
||||
@override final String status;
|
||||
@override final String kycStatus;
|
||||
@override final String kycLevel;
|
||||
@override final String placeOfBirth;
|
||||
@override final String birthCountry;
|
||||
@override final String nationality;
|
||||
@override final String documentType;
|
||||
@override final String document;
|
||||
@override final String? paymentWalletId;
|
||||
@override final int createdAt;
|
||||
|
||||
/// Create a copy of PaymentProfileEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$PaymentProfileEntityCopyWith<_PaymentProfileEntity> get copyWith => __$PaymentProfileEntityCopyWithImpl<_PaymentProfileEntity>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PaymentProfileEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.paymentProfileId, paymentProfileId) || other.paymentProfileId == paymentProfileId)&&(identical(other.jwt, jwt) || other.jwt == jwt)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other._taxResidences, _taxResidences)&&const DeepCollectionEquality().equals(other._addresses, _addresses)&&(identical(other.status, status) || other.status == status)&&(identical(other.kycStatus, kycStatus) || other.kycStatus == kycStatus)&&(identical(other.kycLevel, kycLevel) || other.kycLevel == kycLevel)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.nationality, nationality) || other.nationality == nationality)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.document, document) || other.document == document)&&(identical(other.paymentWalletId, paymentWalletId) || other.paymentWalletId == paymentWalletId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,userId,paymentProfileId,jwt,bornAt,phone,const DeepCollectionEquality().hash(_taxResidences),const DeepCollectionEquality().hash(_addresses),status,kycStatus,kycLevel,placeOfBirth,birthCountry,nationality,documentType,document,paymentWalletId,createdAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentProfileEntity(id: $id, userId: $userId, paymentProfileId: $paymentProfileId, jwt: $jwt, bornAt: $bornAt, phone: $phone, taxResidences: $taxResidences, addresses: $addresses, status: $status, kycStatus: $kycStatus, kycLevel: $kycLevel, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, nationality: $nationality, documentType: $documentType, document: $document, paymentWalletId: $paymentWalletId, createdAt: $createdAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$PaymentProfileEntityCopyWith<$Res> implements $PaymentProfileEntityCopyWith<$Res> {
|
||||
factory _$PaymentProfileEntityCopyWith(_PaymentProfileEntity value, $Res Function(_PaymentProfileEntity) _then) = __$PaymentProfileEntityCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String userId, String paymentProfileId, String? jwt, int bornAt, String phone, List<PaymentProfileAddressEntity> taxResidences, List<PaymentProfileAddressEntity> addresses, String status, String kycStatus, String kycLevel, String placeOfBirth, String birthCountry, String nationality, String documentType, String document, String? paymentWalletId, int createdAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$PaymentProfileEntityCopyWithImpl<$Res>
|
||||
implements _$PaymentProfileEntityCopyWith<$Res> {
|
||||
__$PaymentProfileEntityCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _PaymentProfileEntity _self;
|
||||
final $Res Function(_PaymentProfileEntity) _then;
|
||||
|
||||
/// Create a copy of PaymentProfileEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? userId = null,Object? paymentProfileId = null,Object? jwt = freezed,Object? bornAt = null,Object? phone = null,Object? taxResidences = null,Object? addresses = null,Object? status = null,Object? kycStatus = null,Object? kycLevel = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? nationality = null,Object? documentType = null,Object? document = null,Object? paymentWalletId = freezed,Object? createdAt = null,}) {
|
||||
return _then(_PaymentProfileEntity(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as String,paymentProfileId: null == paymentProfileId ? _self.paymentProfileId : paymentProfileId // ignore: cast_nullable_to_non_nullable
|
||||
as String,jwt: freezed == jwt ? _self.jwt : jwt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,bornAt: null == bornAt ? _self.bornAt : bornAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,taxResidences: null == taxResidences ? _self._taxResidences : taxResidences // ignore: cast_nullable_to_non_nullable
|
||||
as List<PaymentProfileAddressEntity>,addresses: null == addresses ? _self._addresses : addresses // ignore: cast_nullable_to_non_nullable
|
||||
as List<PaymentProfileAddressEntity>,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,kycStatus: null == kycStatus ? _self.kycStatus : kycStatus // ignore: cast_nullable_to_non_nullable
|
||||
as String,kycLevel: null == kycLevel ? _self.kycLevel : kycLevel // ignore: cast_nullable_to_non_nullable
|
||||
as String,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,nationality: null == nationality ? _self.nationality : nationality // ignore: cast_nullable_to_non_nullable
|
||||
as String,documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
|
||||
as String,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
|
||||
as String,paymentWalletId: freezed == paymentWalletId ? _self.paymentWalletId : paymentWalletId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$PaymentProfileAddressEntity {
|
||||
|
||||
String get street; String get city; String get province; String get state; String get country; int get postCode;
|
||||
/// Create a copy of PaymentProfileAddressEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$PaymentProfileAddressEntityCopyWith<PaymentProfileAddressEntity> get copyWith => _$PaymentProfileAddressEntityCopyWithImpl<PaymentProfileAddressEntity>(this as PaymentProfileAddressEntity, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PaymentProfileAddressEntity&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)&&(identical(other.postCode, postCode) || other.postCode == postCode));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,street,city,province,state,country,postCode);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentProfileAddressEntity(street: $street, city: $city, province: $province, state: $state, country: $country, postCode: $postCode)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $PaymentProfileAddressEntityCopyWith<$Res> {
|
||||
factory $PaymentProfileAddressEntityCopyWith(PaymentProfileAddressEntity value, $Res Function(PaymentProfileAddressEntity) _then) = _$PaymentProfileAddressEntityCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String street, String city, String province, String state, String country, int postCode
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$PaymentProfileAddressEntityCopyWithImpl<$Res>
|
||||
implements $PaymentProfileAddressEntityCopyWith<$Res> {
|
||||
_$PaymentProfileAddressEntityCopyWithImpl(this._self, this._then);
|
||||
|
||||
final PaymentProfileAddressEntity _self;
|
||||
final $Res Function(PaymentProfileAddressEntity) _then;
|
||||
|
||||
/// Create a copy of PaymentProfileAddressEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,Object? postCode = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
|
||||
as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
|
||||
as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
|
||||
as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
|
||||
as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
|
||||
as String,postCode: null == postCode ? _self.postCode : postCode // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [PaymentProfileAddressEntity].
|
||||
extension PaymentProfileAddressEntityPatterns on PaymentProfileAddressEntity {
|
||||
/// 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( _PaymentProfileAddressEntity value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileAddressEntity() 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( _PaymentProfileAddressEntity value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileAddressEntity():
|
||||
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( _PaymentProfileAddressEntity value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileAddressEntity() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String street, String city, String province, String state, String country, int postCode)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileAddressEntity() when $default != null:
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.postCode);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String street, String city, String province, String state, String country, int postCode) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileAddressEntity():
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.postCode);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String street, String city, String province, String state, String country, int postCode)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaymentProfileAddressEntity() when $default != null:
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.postCode);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _PaymentProfileAddressEntity implements PaymentProfileAddressEntity {
|
||||
const _PaymentProfileAddressEntity({required this.street, required this.city, required this.province, required this.state, required this.country, required this.postCode});
|
||||
|
||||
|
||||
@override final String street;
|
||||
@override final String city;
|
||||
@override final String province;
|
||||
@override final String state;
|
||||
@override final String country;
|
||||
@override final int postCode;
|
||||
|
||||
/// Create a copy of PaymentProfileAddressEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$PaymentProfileAddressEntityCopyWith<_PaymentProfileAddressEntity> get copyWith => __$PaymentProfileAddressEntityCopyWithImpl<_PaymentProfileAddressEntity>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PaymentProfileAddressEntity&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)&&(identical(other.postCode, postCode) || other.postCode == postCode));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,street,city,province,state,country,postCode);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentProfileAddressEntity(street: $street, city: $city, province: $province, state: $state, country: $country, postCode: $postCode)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$PaymentProfileAddressEntityCopyWith<$Res> implements $PaymentProfileAddressEntityCopyWith<$Res> {
|
||||
factory _$PaymentProfileAddressEntityCopyWith(_PaymentProfileAddressEntity value, $Res Function(_PaymentProfileAddressEntity) _then) = __$PaymentProfileAddressEntityCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String street, String city, String province, String state, String country, int postCode
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$PaymentProfileAddressEntityCopyWithImpl<$Res>
|
||||
implements _$PaymentProfileAddressEntityCopyWith<$Res> {
|
||||
__$PaymentProfileAddressEntityCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _PaymentProfileAddressEntity _self;
|
||||
final $Res Function(_PaymentProfileAddressEntity) _then;
|
||||
|
||||
/// Create a copy of PaymentProfileAddressEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,Object? postCode = null,}) {
|
||||
return _then(_PaymentProfileAddressEntity(
|
||||
street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
|
||||
as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
|
||||
as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
|
||||
as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
|
||||
as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
|
||||
as String,postCode: null == postCode ? _self.postCode : postCode // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,23 +0,0 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'user_entity.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class UserEntity with _$UserEntity {
|
||||
const factory UserEntity({
|
||||
required String id,
|
||||
final String? delegationId,
|
||||
required String email,
|
||||
required int createdAt,
|
||||
final int? updatedAt,
|
||||
required String status,
|
||||
required String role,
|
||||
required int lastLogin,
|
||||
required int currentLogin,
|
||||
required String language,
|
||||
required String firstName,
|
||||
required String lastName,
|
||||
required bool hasApiKey,
|
||||
required String phone,
|
||||
}) = _UserEntity;
|
||||
}
|
||||
@@ -1,310 +0,0 @@
|
||||
// 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 'user_entity.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$UserEntity {
|
||||
|
||||
String get id; String? get delegationId; String get email; int get createdAt; int? get updatedAt; String get status; String get role; int get lastLogin; int get currentLogin; String get language; String get firstName; String get lastName; bool get hasApiKey; String get phone;
|
||||
/// Create a copy of UserEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$UserEntityCopyWith<UserEntity> get copyWith => _$UserEntityCopyWithImpl<UserEntity>(this as UserEntity, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is UserEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserEntity(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $UserEntityCopyWith<$Res> {
|
||||
factory $UserEntityCopyWith(UserEntity value, $Res Function(UserEntity) _then) = _$UserEntityCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String? delegationId, String email, int createdAt, int? updatedAt, String status, String role, int lastLogin, int currentLogin, String language, String firstName, String lastName, bool hasApiKey, String phone
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$UserEntityCopyWithImpl<$Res>
|
||||
implements $UserEntityCopyWith<$Res> {
|
||||
_$UserEntityCopyWithImpl(this._self, this._then);
|
||||
|
||||
final UserEntity _self;
|
||||
final $Res Function(UserEntity) _then;
|
||||
|
||||
/// Create a copy of UserEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = freezed,Object? email = null,Object? createdAt = null,Object? updatedAt = freezed,Object? status = null,Object? role = null,Object? lastLogin = null,Object? currentLogin = null,Object? language = null,Object? firstName = null,Object? lastName = null,Object? hasApiKey = null,Object? phone = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as int?,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,role: null == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
|
||||
as String,lastLogin: null == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
|
||||
as int,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
|
||||
as int,language: null == language ? _self.language : language // 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,hasApiKey: null == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
|
||||
as bool,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [UserEntity].
|
||||
extension UserEntityPatterns on UserEntity {
|
||||
/// 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( _UserEntity value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserEntity() 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( _UserEntity value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserEntity():
|
||||
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( _UserEntity value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserEntity() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String? delegationId, String email, int createdAt, int? updatedAt, String status, String role, int lastLogin, int currentLogin, String language, String firstName, String lastName, bool hasApiKey, String phone)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserEntity() when $default != null:
|
||||
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String? delegationId, String email, int createdAt, int? updatedAt, String status, String role, int lastLogin, int currentLogin, String language, String firstName, String lastName, bool hasApiKey, String phone) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserEntity():
|
||||
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String? delegationId, String email, int createdAt, int? updatedAt, String status, String role, int lastLogin, int currentLogin, String language, String firstName, String lastName, bool hasApiKey, String phone)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserEntity() when $default != null:
|
||||
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _UserEntity implements UserEntity {
|
||||
const _UserEntity({required this.id, this.delegationId, required this.email, required this.createdAt, this.updatedAt, required this.status, required this.role, required this.lastLogin, required this.currentLogin, required this.language, required this.firstName, required this.lastName, required this.hasApiKey, required this.phone});
|
||||
|
||||
|
||||
@override final String id;
|
||||
@override final String? delegationId;
|
||||
@override final String email;
|
||||
@override final int createdAt;
|
||||
@override final int? updatedAt;
|
||||
@override final String status;
|
||||
@override final String role;
|
||||
@override final int lastLogin;
|
||||
@override final int currentLogin;
|
||||
@override final String language;
|
||||
@override final String firstName;
|
||||
@override final String lastName;
|
||||
@override final bool hasApiKey;
|
||||
@override final String phone;
|
||||
|
||||
/// Create a copy of UserEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$UserEntityCopyWith<_UserEntity> get copyWith => __$UserEntityCopyWithImpl<_UserEntity>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UserEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserEntity(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$UserEntityCopyWith<$Res> implements $UserEntityCopyWith<$Res> {
|
||||
factory _$UserEntityCopyWith(_UserEntity value, $Res Function(_UserEntity) _then) = __$UserEntityCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String? delegationId, String email, int createdAt, int? updatedAt, String status, String role, int lastLogin, int currentLogin, String language, String firstName, String lastName, bool hasApiKey, String phone
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$UserEntityCopyWithImpl<$Res>
|
||||
implements _$UserEntityCopyWith<$Res> {
|
||||
__$UserEntityCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _UserEntity _self;
|
||||
final $Res Function(_UserEntity) _then;
|
||||
|
||||
/// Create a copy of UserEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = freezed,Object? email = null,Object? createdAt = null,Object? updatedAt = freezed,Object? status = null,Object? role = null,Object? lastLogin = null,Object? currentLogin = null,Object? language = null,Object? firstName = null,Object? lastName = null,Object? hasApiKey = null,Object? phone = null,}) {
|
||||
return _then(_UserEntity(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as int?,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as String,role: null == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
|
||||
as String,lastLogin: null == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
|
||||
as int,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
|
||||
as int,language: null == language ? _self.language : language // 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,hasApiKey: null == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
|
||||
as bool,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,5 +0,0 @@
|
||||
import 'package:auth/src/features/login/domain/entities/user_entity.dart';
|
||||
|
||||
abstract class GetUserInfoUseCase {
|
||||
Future<UserEntity> getUserInfo();
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import 'package:auth/src/core/domain/repositories/auth_repository.dart';
|
||||
import 'package:auth/src/features/login/domain/entities/user_entity.dart';
|
||||
import 'package:auth/src/features/login/domain/get_me_user_use_case.dart';
|
||||
|
||||
class GetUserInfoUseCaseImpl implements GetUserInfoUseCase {
|
||||
GetUserInfoUseCaseImpl(this._repository);
|
||||
|
||||
final AuthRepository _repository;
|
||||
|
||||
@override
|
||||
Future<UserEntity> getUserInfo() {
|
||||
return _repository.getUserInfo();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import 'package:auth/src/core/providers/auth_repository_provider.dart';
|
||||
import 'package:auth/src/features/login/domain/get_me_user_use_case.dart';
|
||||
import 'package:auth/src/features/login/domain/get_me_user_use_case_impl.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
final getUserInfoUseCaseProvider = Provider.autoDispose<GetUserInfoUseCase>((
|
||||
ref,
|
||||
) {
|
||||
final authRepository = ref.read(authRepositoryProvider);
|
||||
return GetUserInfoUseCaseImpl(authRepository);
|
||||
});
|
||||
@@ -1,9 +1,6 @@
|
||||
import 'package:auth/src/features/login/domain/entities/user_entity.dart';
|
||||
import 'package:auth/src/features/login/domain/get_me_user_use_case.dart';
|
||||
import 'package:auth/src/features/login/domain/login_use_case.dart';
|
||||
import 'package:auth/src/features/login/domain/two_fa_request_code_use_case.dart';
|
||||
import 'package:auth/src/features/login/domain/two_fa_send_code_use_case.dart';
|
||||
import 'package:auth/src/features/login/presentation/providers/get_user_info_provider.dart';
|
||||
import 'package:auth/src/features/login/presentation/providers/login_provider.dart';
|
||||
import 'package:auth/src/features/login/presentation/providers/two_fa_request_code_provider.dart';
|
||||
import 'package:auth/src/features/login/presentation/providers/two_fa_send_code_provider.dart';
|
||||
@@ -11,6 +8,7 @@ import 'package:auth/src/features/login/presentation/state/login_view_state.dart
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
|
||||
final loginViewModelProvider =
|
||||
NotifierProvider.autoDispose<LoginViewModel, LoginViewState>(
|
||||
|
||||
@@ -32,6 +32,8 @@ class SCATreezorViewModel extends Notifier<SCATreezorViewState> {
|
||||
late final TreezorWalletConnectionService _connectionService;
|
||||
late final TreezorWalletSignatureService _signatureService;
|
||||
late final AuthRepository _authRepository;
|
||||
late final GetPaymentProfileUseCase _getPaymentProfileUseCase;
|
||||
late final GetUserInfoUseCase _getUserInfoUseCase;
|
||||
late final SessionLocalDatasource _sessionLocal;
|
||||
|
||||
late final TextEditingController codeController;
|
||||
@@ -52,6 +54,8 @@ class SCATreezorViewModel extends Notifier<SCATreezorViewState> {
|
||||
_connectionService = GetIt.I<TreezorWalletConnectionService>();
|
||||
_signatureService = GetIt.I<TreezorWalletSignatureService>();
|
||||
_authRepository = ref.read(authRepositoryProvider);
|
||||
_getPaymentProfileUseCase = ref.read(getPaymentProfileUseCaseProvider);
|
||||
_getUserInfoUseCase = ref.read(getUserInfoUseCaseProvider);
|
||||
_sessionLocal = ref.read(sessionLocalDatasourceProvider);
|
||||
codeController = TextEditingController();
|
||||
codeController.addListener(_onCodeChanged);
|
||||
@@ -317,8 +321,8 @@ class SCATreezorViewModel extends Notifier<SCATreezorViewState> {
|
||||
if (!connected) return false;
|
||||
|
||||
await signJwtSca();
|
||||
final user = await _authRepository.getUserInfo();
|
||||
final paymentProfile = await _authRepository.getPaymentProfile(
|
||||
final user = await _getUserInfoUseCase.getUserInfo();
|
||||
final paymentProfile = await _getPaymentProfileUseCase.getPaymentProfile(
|
||||
userId: user.id,
|
||||
);
|
||||
debugPrint(
|
||||
@@ -328,6 +332,7 @@ class SCATreezorViewModel extends Notifier<SCATreezorViewState> {
|
||||
if (paymentProfile.paymentWalletId == null ||
|
||||
paymentProfile.paymentWalletId!.isEmpty) {
|
||||
await _authRepository.createWallet();
|
||||
// tengo que coger la walletId de createWallet y pasarlo savePaymentProfileId
|
||||
await _sessionLocal.savePaymentProfileId(paymentProfile.paymentWalletId!);
|
||||
}
|
||||
// remove this when the backend starts returning the walletId on getUserInfo or getPaymentProfile
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
|
||||
class HomeScreen extends ConsumerWidget {
|
||||
final String name = "Juan";
|
||||
final double total = 95.03;
|
||||
final List<Kid> kids = [
|
||||
Kid(name: "Carlos", balance: 25.47, savings: 8.32),
|
||||
@@ -26,6 +25,11 @@ class HomeScreen extends ConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
final NavigationContract navigationContract = GetIt.I<NavigationContract>();
|
||||
final user = ref.watch(userInfoProvider);
|
||||
final rawName = user.value?.firstName ?? "";
|
||||
final name = rawName.isEmpty
|
||||
? ""
|
||||
: rawName[0].toUpperCase() + rawName.substring(1).toLowerCase();
|
||||
|
||||
return SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export 'src/presentation/profile_screen.dart';
|
||||
export 'src/profile_builder.dart';
|
||||
export 'src/profile_settings_builder.dart';
|
||||
|
||||
@@ -80,17 +80,15 @@ class KidLineChart extends ConsumerWidget{
|
||||
return SideTitleWidget(
|
||||
space: 4,
|
||||
meta: meta,
|
||||
child: Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: theme.getColorFor(ThemeCode.textSecondary)
|
||||
)
|
||||
)
|
||||
)
|
||||
child: Center(
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: theme.getColorFor(ThemeCode.textSecondary),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:notifications/notifications.dart';
|
||||
import 'package:profile/src/core/kid_line_chart.dart';
|
||||
import 'package:profile/src/settings_screen.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class ProfileScreen extends ConsumerWidget {
|
||||
const ProfileScreen({super.key});
|
||||
final NavigationContract navigationContract;
|
||||
|
||||
const ProfileScreen({super.key, required this.navigationContract});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -22,10 +24,14 @@ class ProfileScreen extends ConsumerWidget {
|
||||
|
||||
final kids = [
|
||||
Kid(name: "Ana", balance: 15, savings: 5),
|
||||
Kid(name: "Carlos", balance: 15, savings: 5)
|
||||
Kid(name: "Carlos", balance: 15, savings: 5),
|
||||
];
|
||||
|
||||
final name = "Juan";
|
||||
final user = ref.watch(userInfoProvider);
|
||||
final rawName = user.value?.firstName ?? "";
|
||||
final name = rawName.isEmpty
|
||||
? ""
|
||||
: rawName[0].toUpperCase() + rawName.substring(1).toLowerCase();
|
||||
final total = 95.03;
|
||||
final available = 44.09;
|
||||
final savings = 4.16;
|
||||
@@ -44,10 +50,8 @@ class ProfileScreen extends ConsumerWidget {
|
||||
),
|
||||
Spacer(),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => SettingsScreen()),
|
||||
),
|
||||
onPressed: () =>
|
||||
navigationContract.pushTo(AppRoutes.dashboardProfileSettings),
|
||||
child: Text(
|
||||
"Ajustes de la cuenta",
|
||||
style: TextStyle(
|
||||
@@ -57,7 +61,12 @@ class ProfileScreen extends ConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
WalletBalanceBlock(max: total, value: available, savings: savings, savingsPlan: savingsPlan),
|
||||
WalletBalanceBlock(
|
||||
max: total,
|
||||
value: available,
|
||||
savings: savings,
|
||||
savingsPlan: savingsPlan,
|
||||
),
|
||||
LineGraph(),
|
||||
DepositBlock(max: 150 - total),
|
||||
Container(
|
||||
@@ -67,33 +76,34 @@ class ProfileScreen extends ConsumerWidget {
|
||||
color: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
),
|
||||
child: TextButton(
|
||||
onPressed: ()=>{},
|
||||
onPressed: () => {},
|
||||
child: Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
Icon(Icons.output_outlined,
|
||||
Icon(
|
||||
Icons.output_outlined,
|
||||
size: 24,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary)
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
Text(
|
||||
"Retirar dinero del wallet",
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary)
|
||||
)
|
||||
)
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
spacing: 16,
|
||||
children: List<Widget>.generate(kids.length, (int index){
|
||||
children: List<Widget>.generate(kids.length, (int index) {
|
||||
return KidLineChart(kid: kids[index], index: index);
|
||||
})
|
||||
}),
|
||||
),
|
||||
),
|
||||
ActivityList(activity: activity, edit: false),
|
||||
@@ -105,7 +115,10 @@ class ProfileScreen extends ConsumerWidget {
|
||||
children: [
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.only(bottomRight: Radius.circular(24), bottomLeft: Radius.circular(24)),
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomRight: Radius.circular(24),
|
||||
bottomLeft: Radius.circular(24),
|
||||
),
|
||||
color: Color(0xFF4B4B4B),
|
||||
),
|
||||
child: SizedBox(width: double.infinity, height: 200),
|
||||
|
||||
@@ -1,24 +1,79 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:sealed_countries/sealed_countries.dart';
|
||||
import '../providers/payment_profile_provider.dart';
|
||||
|
||||
class SettingsScreen extends ConsumerWidget {
|
||||
const SettingsScreen({super.key});
|
||||
class ProfileSettingsScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
|
||||
const ProfileSettingsScreen({super.key, required this.navigationContract});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
final user = ref.watch(profileSettingsDataProvider);
|
||||
|
||||
final name = "Juan";
|
||||
final balance = 50;
|
||||
final fullName = "Juan Pérez Cruz";
|
||||
final birthDate = "08/03/1976";
|
||||
final relation = "Padre";
|
||||
final address = "Calle Gran Vía 30 6º, 28013";
|
||||
final country = "España";
|
||||
final nationality = "Español";
|
||||
final email = "juanpcruz@gmail.com";
|
||||
final phone = "123456789";
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
body: user.when(
|
||||
loading: () => Center(child: CircularProgressIndicator()),
|
||||
error: (error, _) => Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Error al cargar el perfil",
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
error.toString(),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
TextButton(
|
||||
onPressed: () => ref.invalidate(profileSettingsDataProvider),
|
||||
child: Text("Reintentar"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
data: (data) => _buildContent(context, ref, theme, data),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildContent(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
ThemePort theme,
|
||||
ProfileSettingsData data,
|
||||
) {
|
||||
final profile = data.paymentProfile;
|
||||
final firstName = _capitalize(data.user.firstName);
|
||||
final lastName = _capitalize(data.user.lastName);
|
||||
final fullName = '$firstName $lastName';
|
||||
final birthDate = _formatTimestamp(profile.bornAt);
|
||||
final address = profile.addresses.isNotEmpty
|
||||
? '${profile.addresses.first.street}, ${profile.addresses.first.postCode} ${profile.addresses.first.city}'
|
||||
: '-';
|
||||
final country = profile.addresses.isNotEmpty
|
||||
? profile.addresses.first.country
|
||||
: profile.birthCountry;
|
||||
final locale = Localizations.localeOf(context).languageCode;
|
||||
final nationality = _countryNameFromCode(profile.nationality, locale);
|
||||
|
||||
final content = [
|
||||
Center(
|
||||
@@ -31,12 +86,6 @@ class SettingsScreen extends ConsumerWidget {
|
||||
color: theme.getColorFor(ThemeCode.textSecondary),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"Saldo: $balance€",
|
||||
style: TextStyle(
|
||||
color: theme.getColorFor(ThemeCode.textSecondary),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -52,7 +101,7 @@ class SettingsScreen extends ConsumerWidget {
|
||||
spacing: 10,
|
||||
children: [
|
||||
Text(
|
||||
name,
|
||||
firstName,
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
|
||||
),
|
||||
Spacer(),
|
||||
@@ -60,7 +109,15 @@ class SettingsScreen extends ConsumerWidget {
|
||||
Icon(Icons.account_balance, size: 24),
|
||||
],
|
||||
),
|
||||
Align(alignment: Alignment.centerLeft, child: Text(relation)),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
data.user.status.toUpperCase(),
|
||||
style: TextStyle(
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -82,50 +139,13 @@ class SettingsScreen extends ConsumerWidget {
|
||||
TextButton(onPressed: () => {}, child: Text("Editar")),
|
||||
],
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
text: "Nombre: ",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: fullName,
|
||||
style: TextStyle(fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
text: "Fecha de nacimiento: ",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: birthDate,
|
||||
style: TextStyle(fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
text: "Familiar: ",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: relation,
|
||||
style: TextStyle(fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
_labelValue("Nombre", fullName),
|
||||
_labelValue("Fecha de nacimiento", birthDate),
|
||||
_labelValue("Nacionalidad", nationality),
|
||||
_labelValue("Lugar de nacimiento", profile.placeOfBirth),
|
||||
_labelValue(
|
||||
"Documento (${profile.documentType})",
|
||||
profile.document.toUpperCase(),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -148,51 +168,9 @@ class SettingsScreen extends ConsumerWidget {
|
||||
TextButton(onPressed: () => {}, child: Text("Editar")),
|
||||
],
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
text: "Dirección: ",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: address,
|
||||
style: TextStyle(fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
text: "País: ",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: country,
|
||||
style: TextStyle(fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
text: "Nacionalidad: ",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: nationality,
|
||||
style: TextStyle(fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
_labelValue("Dirección", address),
|
||||
_labelValue("País", country),
|
||||
_labelValue("Nacionalidad", nationality),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -214,36 +192,8 @@ class SettingsScreen extends ConsumerWidget {
|
||||
TextButton(onPressed: () => {}, child: Text("Editar")),
|
||||
],
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
text: "Correo: ",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: email,
|
||||
style: TextStyle(fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
text: "Teléfono: ",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: phone,
|
||||
style: TextStyle(fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
_labelValue("Correo", data.user.email),
|
||||
_labelValue("Teléfono", profile.phone),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -299,9 +249,11 @@ class SettingsScreen extends ConsumerWidget {
|
||||
"Retirar y reembolsar dinero del wallet",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
|
||||
),
|
||||
Text("Para transferirte el saldo a tu cuenta necesitamos tu IBAN y algunos datos básics. Así nos aseguramos de que la transferencia sea segura y rápida."),
|
||||
Text(
|
||||
"Para transferirte el saldo a tu cuenta necesitamos tu IBAN y algunos datos básics. Así nos aseguramos de que la transferencia sea segura y rápida.",
|
||||
),
|
||||
CustomTextField(label: "Nombre y Apellidos", hint: "******"),
|
||||
CustomTextField(label: "IBAN con número español", hint: "******")
|
||||
CustomTextField(label: "IBAN con número español", hint: "******"),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -334,7 +286,7 @@ class SettingsScreen extends ConsumerWidget {
|
||||
style: TextStyle(fontSize: 16, letterSpacing: 0),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
@@ -347,7 +299,7 @@ class SettingsScreen extends ConsumerWidget {
|
||||
style: TextStyle(fontSize: 16, letterSpacing: 0),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
@@ -360,7 +312,7 @@ class SettingsScreen extends ConsumerWidget {
|
||||
style: TextStyle(fontSize: 16, letterSpacing: 0),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -371,89 +323,130 @@ class SettingsScreen extends ConsumerWidget {
|
||||
Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: TextButton(
|
||||
style: ButtonStyle(padding: WidgetStatePropertyAll(EdgeInsets.all(0))),
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStatePropertyAll(EdgeInsets.all(0)),
|
||||
),
|
||||
onPressed: () => {},
|
||||
child: Row(
|
||||
spacing: 4,
|
||||
children: [
|
||||
Icon(Icons.contact_support_outlined, size: 24),
|
||||
Text("Contáctanos")
|
||||
Text("Contáctanos"),
|
||||
],
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: TextButton(
|
||||
style: ButtonStyle(padding: WidgetStatePropertyAll(EdgeInsets.all(0))),
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStatePropertyAll(EdgeInsets.all(0)),
|
||||
),
|
||||
onPressed: () => {},
|
||||
child: Row(
|
||||
spacing: 4,
|
||||
children: [
|
||||
Icon(Icons.contact_support_outlined, size: 24),
|
||||
Text("Preguntas frecuentes")
|
||||
Text("Preguntas frecuentes"),
|
||||
],
|
||||
)
|
||||
)
|
||||
),
|
||||
],
|
||||
)
|
||||
];
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
body: Stack(
|
||||
children: [
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.only(bottomLeft: Radius.circular(24), bottomRight: Radius.circular(24)),
|
||||
color: Color(0xFF4B4B4B),
|
||||
),
|
||||
),
|
||||
child: SizedBox(width: double.infinity, height: 200),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(20),
|
||||
child: ListView.separated(
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return content[index];
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(color: Colors.transparent, height: 20);
|
||||
},
|
||||
itemCount: content.length,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(20),
|
||||
),
|
||||
color: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
PrimaryButton(
|
||||
onPressed: () => {},
|
||||
text: "Guardar cambios",
|
||||
color: theme.getColorFor(ThemeCode.buttonPrimary)
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text("Cancelar"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
];
|
||||
|
||||
return Stack(
|
||||
children: [
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(24),
|
||||
bottomRight: Radius.circular(24),
|
||||
),
|
||||
color: Color(0xFF4B4B4B),
|
||||
),
|
||||
child: SizedBox(width: double.infinity, height: 200),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(20),
|
||||
child: ListView.separated(
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return content[index];
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(color: Colors.transparent, height: 20);
|
||||
},
|
||||
itemCount: content.length,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(20),
|
||||
),
|
||||
color: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
PrimaryButton(
|
||||
onPressed: () => {},
|
||||
text: "Guardar cambios",
|
||||
color: theme.getColorFor(ThemeCode.buttonPrimary),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => navigationContract.goBack(),
|
||||
child: Text("Cancelar"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _labelValue(String label, String value) {
|
||||
return Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
text: "$label: ",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: value,
|
||||
style: TextStyle(fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _capitalize(String s) =>
|
||||
s.isEmpty ? s : s[0].toUpperCase() + s.substring(1).toLowerCase();
|
||||
|
||||
String _countryNameFromCode(String code, String locale) {
|
||||
if (code.isEmpty) return '-';
|
||||
try {
|
||||
final country = WorldCountry.fromCodeShort(code.toUpperCase());
|
||||
final language = NaturalLanguage.fromCodeShort(locale);
|
||||
return country.commonNameFor(BasicTypedLocale(language));
|
||||
} catch (_) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
String _formatTimestamp(int timestamp) {
|
||||
final date = DateTime.fromMillisecondsSinceEpoch(timestamp);
|
||||
return '${date.day.toString().padLeft(2, '0')}/${date.month.toString().padLeft(2, '0')}/${date.year}';
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:profile/profile.dart';
|
||||
|
||||
class ProfileBuilder {
|
||||
const ProfileBuilder();
|
||||
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
return MaterialPage(child: ProfileScreen());
|
||||
final navigationContract = GetIt.I<NavigationContract>();
|
||||
return MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: ProfileScreen(navigationContract: navigationContract),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
17
modules/profile/lib/src/profile_settings_builder.dart
Normal file
17
modules/profile/lib/src/profile_settings_builder.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:profile/src/presentation/profile_settings_screen.dart';
|
||||
|
||||
class ProfileSettingsBuilder {
|
||||
const ProfileSettingsBuilder();
|
||||
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
final navigationContract = GetIt.I<NavigationContract>();
|
||||
return MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: ProfileSettingsScreen(navigationContract: navigationContract),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
|
||||
class ProfileSettingsData {
|
||||
final UserEntity user;
|
||||
final PaymentProfileEntity paymentProfile;
|
||||
|
||||
const ProfileSettingsData({
|
||||
required this.user,
|
||||
required this.paymentProfile,
|
||||
});
|
||||
}
|
||||
|
||||
final profileSettingsDataProvider =
|
||||
FutureProvider.autoDispose<ProfileSettingsData>((ref) async {
|
||||
final getUserInfoUseCase = ref.read(getUserInfoUseCaseProvider);
|
||||
final getPaymentProfileUseCase = ref.read(getPaymentProfileUseCaseProvider);
|
||||
|
||||
final user = await getUserInfoUseCase.getUserInfo();
|
||||
final paymentProfile =
|
||||
await getPaymentProfileUseCase.getPaymentProfile(userId: user.id);
|
||||
|
||||
return ProfileSettingsData(
|
||||
user: user,
|
||||
paymentProfile: paymentProfile,
|
||||
);
|
||||
});
|
||||
@@ -20,8 +20,11 @@ dependencies:
|
||||
path: ../../packages/design_system
|
||||
sf_shared:
|
||||
path: ../../packages/sf_shared
|
||||
navigation:
|
||||
path: ../../packages/navigation
|
||||
|
||||
#dependencies go here
|
||||
sealed_countries: ^2.8.0
|
||||
flutter_riverpod: ^3.0.3
|
||||
get_it: ^9.0.5
|
||||
go_router: ^17.0.0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# melos_managed_dependency_overrides: design_system,notifications,sf_shared,utils,fonts,sf_infrastructure,flutter_treezor_entrust_sdk_bridge,sca_treezor
|
||||
# melos_managed_dependency_overrides: design_system,notifications,sf_shared,utils,fonts,sf_infrastructure,flutter_treezor_entrust_sdk_bridge,sca_treezor,navigation
|
||||
dependency_overrides:
|
||||
design_system:
|
||||
path: ../../packages/design_system
|
||||
@@ -6,6 +6,8 @@ dependency_overrides:
|
||||
path: ../../packages/flutter_treezor_entrust_sdk_bridge
|
||||
fonts:
|
||||
path: ../../packages/fonts
|
||||
navigation:
|
||||
path: ../../packages/navigation
|
||||
notifications:
|
||||
path: ../notifications
|
||||
sca_treezor:
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
abstract class SplashRemoteDatasource {
|
||||
Future<List<dynamic>> getChildProfiles();
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||
|
||||
import 'splash_remote_datasource.dart';
|
||||
|
||||
class SplashRemoteDatasourceImpl implements SplashRemoteDatasource {
|
||||
SplashRemoteDatasourceImpl(this._repository);
|
||||
|
||||
final QuestiaRepository _repository;
|
||||
|
||||
@override
|
||||
Future<List<dynamic>> getChildProfiles() async {
|
||||
final response =
|
||||
await _repository.get<Map<String, dynamic>>('/child-profiles');
|
||||
final data = response.data;
|
||||
if (data == null) return [];
|
||||
final items = data['items'] ?? data['data'] ?? [];
|
||||
return items is List ? items : [];
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
|
||||
import '../data/splash_remote_datasource.dart';
|
||||
import 'check_session_use_case.dart';
|
||||
import 'initial_route.dart';
|
||||
|
||||
class CheckSessionUseCaseImpl implements CheckSessionUseCase {
|
||||
CheckSessionUseCaseImpl(this._datasource);
|
||||
CheckSessionUseCaseImpl(this._userRepository);
|
||||
|
||||
final SplashRemoteDatasource _datasource;
|
||||
final UserRepository _userRepository;
|
||||
|
||||
@override
|
||||
Future<InitialRoute> execute() async {
|
||||
try {
|
||||
final profiles = await _datasource.getChildProfiles();
|
||||
final profiles = await _userRepository.getChildProfiles();
|
||||
return profiles.isEmpty ? InitialRoute.deviceSetup : InitialRoute.home;
|
||||
} catch (e) {
|
||||
debugPrint('[CheckSessionUseCase] error: $e');
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:get_it/get_it.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:navigation/navigation_contract.dart';
|
||||
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||
import 'package:splash/src/data/splash_remote_datasource_impl.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:splash/src/domain/check_session_use_case_impl.dart';
|
||||
import 'package:splash/src/presentation/splash_screen.dart';
|
||||
|
||||
@@ -12,8 +12,9 @@ class SplashBuilder {
|
||||
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
final navigationContract = GetIt.I<NavigationContract>();
|
||||
final datasource = SplashRemoteDatasourceImpl(GetIt.I<QuestiaRepository>());
|
||||
final checkSessionUseCase = CheckSessionUseCaseImpl(datasource);
|
||||
final remote = UserRemoteDatasourceImpl(GetIt.I<QuestiaRepository>());
|
||||
final userRepository = UserRepositoryImpl(remote);
|
||||
final checkSessionUseCase = CheckSessionUseCaseImpl(userRepository);
|
||||
|
||||
return NoTransitionPage(
|
||||
child: SplashScreen(
|
||||
|
||||
@@ -19,6 +19,8 @@ dependencies:
|
||||
path: ../../packages/navigation
|
||||
sf_infrastructure:
|
||||
path: ../../packages/sf_infrastructure
|
||||
sf_shared:
|
||||
path: ../../packages/sf_shared
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
# melos_managed_dependency_overrides: navigation
|
||||
# melos_managed_dependency_overrides: navigation,sf_infrastructure,design_system,flutter_treezor_entrust_sdk_bridge,fonts,sca_treezor,sf_shared,utils
|
||||
dependency_overrides:
|
||||
design_system:
|
||||
path: ../../packages/design_system
|
||||
flutter_treezor_entrust_sdk_bridge:
|
||||
path: ../../packages/flutter_treezor_entrust_sdk_bridge
|
||||
fonts:
|
||||
path: ../../packages/fonts
|
||||
navigation:
|
||||
path: ../../packages/navigation
|
||||
sca_treezor:
|
||||
path: ../../packages/sca_treezor
|
||||
sf_infrastructure:
|
||||
path: ../../packages/sf_infrastructure
|
||||
sf_shared:
|
||||
path: ../../packages/sf_shared
|
||||
utils:
|
||||
path: ../../packages/utils
|
||||
|
||||
Reference in New Issue
Block a user