added personal_data endpoints, providers and states

This commit is contained in:
2026-02-02 15:14:44 +01:00
parent 880dd85d2b
commit d515d0596f
41 changed files with 2737 additions and 52 deletions

View File

@@ -48,6 +48,16 @@ void configureAppRouter() {
name: 'account_settings',
pageBuilder: AccountSettingsBuilder().buildPage,
),
GoRoute(
path: AppRoutes.personalData,
name: 'personal_data',
pageBuilder: PersonalDataBuilder().buildPage,
),
GoRoute(
path: AppRoutes.linkedDevices,
name: 'linked_devices',
pageBuilder: LinkedDevicesBuilder().buildPage,
),
GoRoute(
path: AppRoutes.login,

View File

@@ -1,5 +1,11 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/user_entity.dart';
abstract class AccountRemoteDatasource {
Future<List<DeviceEntity>> getLinkedDevices({required String userId});
Future<UserEntity> getLoggedUser({required String token});
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request});
}

View File

@@ -2,15 +2,19 @@ import 'dart:convert';
import 'package:account/src/core/data/datasource/account_remote_datasource.dart';
import 'package:account/src/core/data/models/get_linked_devices_response_model.dart';
import 'package:account/src/core/data/models/get_logged_user_response_model.dart';
import 'package:account/src/core/data/models/update_user_request_model.dart';
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/user_entity.dart';
import 'package:dio/dio.dart';
// import 'package:flutter/material.dart';
// import 'package:sf_infrastructure/sf_infrastructure.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
class AccountRemoteDatasourceImpl implements AccountRemoteDatasource {
AccountRemoteDatasourceImpl(/*this._repository*/);
AccountRemoteDatasourceImpl(this._repository);
// final QuestiaRepository _repository;
final QuestiaRepository _repository;
@override
Future<List<DeviceEntity>> getLinkedDevices({required String userId}) async {
@@ -42,6 +46,47 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource {
);
}
}
@override
Future<UserEntity> getLoggedUser({required String token}) async {
try {
/*final response = await _repository.get<Map<String, dynamic>>(
'/users/api/auth/me',
);
final data = response.data!['item'];
if (data == null || data.isEmpty) {
throw Exception('Empty response from /auth/me');
}
final model = GetUserResponseModel.fromJson(data);*/
final model = GetLoggedUserResponseModel(item:
GetLoggedUserItemResponseModel(
id: '1111',
firstName: 'Juan',
email: 'juan@test.com',
phone: '111111111'));
print(model.toEntity());
return model.toEntity();
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: error.message ?? 'Error getting devices',
);
}
}
@override
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request}) async {
try {
final body = request.toModel().toJson();
await _repository.put<void>(
'/users/$userId',
body: body,
);
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error in verification code');
}
}
}
Exception _mapDioError(DioException error, {required String defaultMessage}) {

View File

@@ -0,0 +1,60 @@
import 'package:account/src/features/personal_data/domain/entities/user_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'get_logged_user_response_model.freezed.dart';
part 'get_logged_user_response_model.g.dart';
@freezed
abstract class GetLoggedUserResponseModel with _$GetLoggedUserResponseModel {
const factory GetLoggedUserResponseModel({
required GetLoggedUserItemResponseModel item,
}) = _GetLoggedUserResponseModel;
factory GetLoggedUserResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetLoggedUserResponseModelFromJson(json);
}
@freezed
abstract class GetLoggedUserItemResponseModel with _$GetLoggedUserItemResponseModel {
const factory GetLoggedUserItemResponseModel({
required String id,
String? delegationId,
String? email,
String? createdAt,
String? updatedAt,
String? status,
String? role,
String? lastLogin,
String? currentLogin,
String? language,
String? firstName,
String? lastName,
String? hasApiKey,
String? phone,
}) =
_GetLoggedUserItemResponseModel;
factory GetLoggedUserItemResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetLoggedUserItemResponseModelFromJson(json);
}
extension GetLoggedUserResponseModelMapper on GetLoggedUserResponseModel {
UserEntity toEntity() {
return UserEntity(
id: item.id,
delegationId: item.delegationId ?? '',
email: item.email ?? '',
createdAt: item.createdAt ?? '',
updatedAt: item.updatedAt ?? '',
status: item.status ?? '',
role: item.role ?? '',
lastLogin: item.lastLogin ?? '',
currentLogin: item.currentLogin ?? '',
language: item.language ?? '',
firstName: item.firstName ?? '',
lastName: item.lastName ?? '',
hasApiKey: item.hasApiKey ?? '',
phone: item.phone ?? ''
);
}
}

View File

@@ -0,0 +1,597 @@
// 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 'get_logged_user_response_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$GetLoggedUserResponseModel {
GetLoggedUserItemResponseModel get item;
/// Create a copy of GetLoggedUserResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetLoggedUserResponseModelCopyWith<GetLoggedUserResponseModel> get copyWith => _$GetLoggedUserResponseModelCopyWithImpl<GetLoggedUserResponseModel>(this as GetLoggedUserResponseModel, _$identity);
/// Serializes this GetLoggedUserResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLoggedUserResponseModel&&(identical(other.item, item) || other.item == item));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,item);
@override
String toString() {
return 'GetLoggedUserResponseModel(item: $item)';
}
}
/// @nodoc
abstract mixin class $GetLoggedUserResponseModelCopyWith<$Res> {
factory $GetLoggedUserResponseModelCopyWith(GetLoggedUserResponseModel value, $Res Function(GetLoggedUserResponseModel) _then) = _$GetLoggedUserResponseModelCopyWithImpl;
@useResult
$Res call({
GetLoggedUserItemResponseModel item
});
$GetLoggedUserItemResponseModelCopyWith<$Res> get item;
}
/// @nodoc
class _$GetLoggedUserResponseModelCopyWithImpl<$Res>
implements $GetLoggedUserResponseModelCopyWith<$Res> {
_$GetLoggedUserResponseModelCopyWithImpl(this._self, this._then);
final GetLoggedUserResponseModel _self;
final $Res Function(GetLoggedUserResponseModel) _then;
/// Create a copy of GetLoggedUserResponseModel
/// 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 GetLoggedUserItemResponseModel,
));
}
/// Create a copy of GetLoggedUserResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$GetLoggedUserItemResponseModelCopyWith<$Res> get item {
return $GetLoggedUserItemResponseModelCopyWith<$Res>(_self.item, (value) {
return _then(_self.copyWith(item: value));
});
}
}
/// Adds pattern-matching-related methods to [GetLoggedUserResponseModel].
extension GetLoggedUserResponseModelPatterns on GetLoggedUserResponseModel {
/// 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( _GetLoggedUserResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetLoggedUserResponseModel() 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( _GetLoggedUserResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetLoggedUserResponseModel():
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( _GetLoggedUserResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetLoggedUserResponseModel() 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( GetLoggedUserItemResponseModel item)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetLoggedUserResponseModel() 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( GetLoggedUserItemResponseModel item) $default,) {final _that = this;
switch (_that) {
case _GetLoggedUserResponseModel():
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( GetLoggedUserItemResponseModel item)? $default,) {final _that = this;
switch (_that) {
case _GetLoggedUserResponseModel() when $default != null:
return $default(_that.item);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetLoggedUserResponseModel implements GetLoggedUserResponseModel {
const _GetLoggedUserResponseModel({required this.item});
factory _GetLoggedUserResponseModel.fromJson(Map<String, dynamic> json) => _$GetLoggedUserResponseModelFromJson(json);
@override final GetLoggedUserItemResponseModel item;
/// Create a copy of GetLoggedUserResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetLoggedUserResponseModelCopyWith<_GetLoggedUserResponseModel> get copyWith => __$GetLoggedUserResponseModelCopyWithImpl<_GetLoggedUserResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetLoggedUserResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLoggedUserResponseModel&&(identical(other.item, item) || other.item == item));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,item);
@override
String toString() {
return 'GetLoggedUserResponseModel(item: $item)';
}
}
/// @nodoc
abstract mixin class _$GetLoggedUserResponseModelCopyWith<$Res> implements $GetLoggedUserResponseModelCopyWith<$Res> {
factory _$GetLoggedUserResponseModelCopyWith(_GetLoggedUserResponseModel value, $Res Function(_GetLoggedUserResponseModel) _then) = __$GetLoggedUserResponseModelCopyWithImpl;
@override @useResult
$Res call({
GetLoggedUserItemResponseModel item
});
@override $GetLoggedUserItemResponseModelCopyWith<$Res> get item;
}
/// @nodoc
class __$GetLoggedUserResponseModelCopyWithImpl<$Res>
implements _$GetLoggedUserResponseModelCopyWith<$Res> {
__$GetLoggedUserResponseModelCopyWithImpl(this._self, this._then);
final _GetLoggedUserResponseModel _self;
final $Res Function(_GetLoggedUserResponseModel) _then;
/// Create a copy of GetLoggedUserResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? item = null,}) {
return _then(_GetLoggedUserResponseModel(
item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable
as GetLoggedUserItemResponseModel,
));
}
/// Create a copy of GetLoggedUserResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$GetLoggedUserItemResponseModelCopyWith<$Res> get item {
return $GetLoggedUserItemResponseModelCopyWith<$Res>(_self.item, (value) {
return _then(_self.copyWith(item: value));
});
}
}
/// @nodoc
mixin _$GetLoggedUserItemResponseModel {
String get id; String? get delegationId; String? get email; String? get createdAt; String? get updatedAt; String? get status; String? get role; String? get lastLogin; String? get currentLogin; String? get language; String? get firstName; String? get lastName; String? get hasApiKey; String? get phone;
/// Create a copy of GetLoggedUserItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetLoggedUserItemResponseModelCopyWith<GetLoggedUserItemResponseModel> get copyWith => _$GetLoggedUserItemResponseModelCopyWithImpl<GetLoggedUserItemResponseModel>(this as GetLoggedUserItemResponseModel, _$identity);
/// Serializes this GetLoggedUserItemResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLoggedUserItemResponseModel&&(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 'GetLoggedUserItemResponseModel(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 $GetLoggedUserItemResponseModelCopyWith<$Res> {
factory $GetLoggedUserItemResponseModelCopyWith(GetLoggedUserItemResponseModel value, $Res Function(GetLoggedUserItemResponseModel) _then) = _$GetLoggedUserItemResponseModelCopyWithImpl;
@useResult
$Res call({
String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone
});
}
/// @nodoc
class _$GetLoggedUserItemResponseModelCopyWithImpl<$Res>
implements $GetLoggedUserItemResponseModelCopyWith<$Res> {
_$GetLoggedUserItemResponseModelCopyWithImpl(this._self, this._then);
final GetLoggedUserItemResponseModel _self;
final $Res Function(GetLoggedUserItemResponseModel) _then;
/// Create a copy of GetLoggedUserItemResponseModel
/// 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 = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) {
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: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// Adds pattern-matching-related methods to [GetLoggedUserItemResponseModel].
extension GetLoggedUserItemResponseModelPatterns on GetLoggedUserItemResponseModel {
/// 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( _GetLoggedUserItemResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetLoggedUserItemResponseModel() 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( _GetLoggedUserItemResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetLoggedUserItemResponseModel():
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( _GetLoggedUserItemResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetLoggedUserItemResponseModel() 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, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetLoggedUserItemResponseModel() 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, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone) $default,) {final _that = this;
switch (_that) {
case _GetLoggedUserItemResponseModel():
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, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,) {final _that = this;
switch (_that) {
case _GetLoggedUserItemResponseModel() 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 _GetLoggedUserItemResponseModel implements GetLoggedUserItemResponseModel {
const _GetLoggedUserItemResponseModel({required this.id, this.delegationId, this.email, this.createdAt, this.updatedAt, this.status, this.role, this.lastLogin, this.currentLogin, this.language, this.firstName, this.lastName, this.hasApiKey, this.phone});
factory _GetLoggedUserItemResponseModel.fromJson(Map<String, dynamic> json) => _$GetLoggedUserItemResponseModelFromJson(json);
@override final String id;
@override final String? delegationId;
@override final String? email;
@override final String? createdAt;
@override final String? updatedAt;
@override final String? status;
@override final String? role;
@override final String? lastLogin;
@override final String? currentLogin;
@override final String? language;
@override final String? firstName;
@override final String? lastName;
@override final String? hasApiKey;
@override final String? phone;
/// Create a copy of GetLoggedUserItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetLoggedUserItemResponseModelCopyWith<_GetLoggedUserItemResponseModel> get copyWith => __$GetLoggedUserItemResponseModelCopyWithImpl<_GetLoggedUserItemResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetLoggedUserItemResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLoggedUserItemResponseModel&&(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 'GetLoggedUserItemResponseModel(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 _$GetLoggedUserItemResponseModelCopyWith<$Res> implements $GetLoggedUserItemResponseModelCopyWith<$Res> {
factory _$GetLoggedUserItemResponseModelCopyWith(_GetLoggedUserItemResponseModel value, $Res Function(_GetLoggedUserItemResponseModel) _then) = __$GetLoggedUserItemResponseModelCopyWithImpl;
@override @useResult
$Res call({
String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone
});
}
/// @nodoc
class __$GetLoggedUserItemResponseModelCopyWithImpl<$Res>
implements _$GetLoggedUserItemResponseModelCopyWith<$Res> {
__$GetLoggedUserItemResponseModelCopyWithImpl(this._self, this._then);
final _GetLoggedUserItemResponseModel _self;
final $Res Function(_GetLoggedUserItemResponseModel) _then;
/// Create a copy of GetLoggedUserItemResponseModel
/// 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 = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) {
return _then(_GetLoggedUserItemResponseModel(
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: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,57 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'get_logged_user_response_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_GetLoggedUserResponseModel _$GetLoggedUserResponseModelFromJson(
Map<String, dynamic> json,
) => _GetLoggedUserResponseModel(
item: GetLoggedUserItemResponseModel.fromJson(
json['item'] as Map<String, dynamic>,
),
);
Map<String, dynamic> _$GetLoggedUserResponseModelToJson(
_GetLoggedUserResponseModel instance,
) => <String, dynamic>{'item': instance.item};
_GetLoggedUserItemResponseModel _$GetLoggedUserItemResponseModelFromJson(
Map<String, dynamic> json,
) => _GetLoggedUserItemResponseModel(
id: json['id'] as String,
delegationId: json['delegationId'] as String?,
email: json['email'] as String?,
createdAt: json['createdAt'] as String?,
updatedAt: json['updatedAt'] as String?,
status: json['status'] as String?,
role: json['role'] as String?,
lastLogin: json['lastLogin'] as String?,
currentLogin: json['currentLogin'] as String?,
language: json['language'] as String?,
firstName: json['firstName'] as String?,
lastName: json['lastName'] as String?,
hasApiKey: json['hasApiKey'] as String?,
phone: json['phone'] as String?,
);
Map<String, dynamic> _$GetLoggedUserItemResponseModelToJson(
_GetLoggedUserItemResponseModel 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,
};

View File

@@ -0,0 +1,50 @@
/*
import 'package:freezed_annotation/freezed_annotation.dart';
part 'update_device_request_model.freezed.dart';
part 'update_device_request_model.g.dart';
@freezed
abstract class UpdateDeviceRequestModel with _$UpdateDeviceRequestModel {
const factory UpdateDeviceRequestModel({
required String deviceIdentificator,
required String lastName,
required String email,
required String phone,
required String language,
required String password,
required List<AddressModel> taxResidences,
required List<AddressModel> addresses,
// ignore: invalid_annotation_target
@JsonKey(name: 'document') required String documentNumber,
required String documentType,
// ignore: invalid_annotation_target
@JsonKey(name: 'relationType') required String relationship,
}) = _UpdateDeviceRequestModel;
factory UpdateDeviceRequestModel.fromCsv(Map<String, dynamic> json) =>
_$UpdateDeviceRequestModelFromCsv(csv);
@override
@JsonKey(name: 'document')
String get documentNumber;
@override
@JsonKey(name: 'relationType')
String get relationship;
}
extension UpdateDeviceRequestModelMapper on UpdateDeviceRequestEntity {
UpdateDeviceRequestModel toModel() => UpdateDeviceRequestModel(
firstName: firstName,
lastName: lastName,
email: email,
phone: phone,
language: language,
password: password,
taxResidences: taxResidences
.map((e) => e.toModel())
.toList(growable: false),
addresses: addresses.map((e) => e.toModel()).toList(growable: false),
);
}
*/

View File

@@ -0,0 +1 @@
part of 'update_device_request_model.dart';

View File

@@ -0,0 +1,47 @@
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'update_user_request_model.freezed.dart';
part 'update_user_request_model.g.dart';
@freezed
abstract class UpdateUserRequestModel with _$UpdateUserRequestModel {
const factory UpdateUserRequestModel({
required String id,
String? delegationId,
String? email,
String? createdAt,
String? updatedAt,
String? status,
String? role,
String? lastLogin,
String? currentLogin,
String? language,
String? firstName,
String? lastName,
String? hasApiKey,
String? phone,
}) = _UpdateUserRequestModel;
factory UpdateUserRequestModel.fromJson(Map<String, dynamic> json) =>
_$UpdateUserRequestModelFromJson(json);
}
extension UpdateUserRequestModelMapper on UpdateUserRequestEntity {
UpdateUserRequestModel toModel() => UpdateUserRequestModel(
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,
);
}

View File

@@ -0,0 +1,316 @@
// 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 'update_user_request_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$UpdateUserRequestModel {
String get id; String? get delegationId; String? get email; String? get createdAt; String? get updatedAt; String? get status; String? get role; String? get lastLogin; String? get currentLogin; String? get language; String? get firstName; String? get lastName; String? get hasApiKey; String? get phone;
/// Create a copy of UpdateUserRequestModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$UpdateUserRequestModelCopyWith<UpdateUserRequestModel> get copyWith => _$UpdateUserRequestModelCopyWithImpl<UpdateUserRequestModel>(this as UpdateUserRequestModel, _$identity);
/// Serializes this UpdateUserRequestModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateUserRequestModel&&(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 'UpdateUserRequestModel(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 $UpdateUserRequestModelCopyWith<$Res> {
factory $UpdateUserRequestModelCopyWith(UpdateUserRequestModel value, $Res Function(UpdateUserRequestModel) _then) = _$UpdateUserRequestModelCopyWithImpl;
@useResult
$Res call({
String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone
});
}
/// @nodoc
class _$UpdateUserRequestModelCopyWithImpl<$Res>
implements $UpdateUserRequestModelCopyWith<$Res> {
_$UpdateUserRequestModelCopyWithImpl(this._self, this._then);
final UpdateUserRequestModel _self;
final $Res Function(UpdateUserRequestModel) _then;
/// Create a copy of UpdateUserRequestModel
/// 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 = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) {
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: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// Adds pattern-matching-related methods to [UpdateUserRequestModel].
extension UpdateUserRequestModelPatterns on UpdateUserRequestModel {
/// 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( _UpdateUserRequestModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _UpdateUserRequestModel() 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( _UpdateUserRequestModel value) $default,){
final _that = this;
switch (_that) {
case _UpdateUserRequestModel():
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( _UpdateUserRequestModel value)? $default,){
final _that = this;
switch (_that) {
case _UpdateUserRequestModel() 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, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _UpdateUserRequestModel() 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, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone) $default,) {final _that = this;
switch (_that) {
case _UpdateUserRequestModel():
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, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,) {final _that = this;
switch (_that) {
case _UpdateUserRequestModel() 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 _UpdateUserRequestModel implements UpdateUserRequestModel {
const _UpdateUserRequestModel({required this.id, this.delegationId, this.email, this.createdAt, this.updatedAt, this.status, this.role, this.lastLogin, this.currentLogin, this.language, this.firstName, this.lastName, this.hasApiKey, this.phone});
factory _UpdateUserRequestModel.fromJson(Map<String, dynamic> json) => _$UpdateUserRequestModelFromJson(json);
@override final String id;
@override final String? delegationId;
@override final String? email;
@override final String? createdAt;
@override final String? updatedAt;
@override final String? status;
@override final String? role;
@override final String? lastLogin;
@override final String? currentLogin;
@override final String? language;
@override final String? firstName;
@override final String? lastName;
@override final String? hasApiKey;
@override final String? phone;
/// Create a copy of UpdateUserRequestModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$UpdateUserRequestModelCopyWith<_UpdateUserRequestModel> get copyWith => __$UpdateUserRequestModelCopyWithImpl<_UpdateUserRequestModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$UpdateUserRequestModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateUserRequestModel&&(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 'UpdateUserRequestModel(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 _$UpdateUserRequestModelCopyWith<$Res> implements $UpdateUserRequestModelCopyWith<$Res> {
factory _$UpdateUserRequestModelCopyWith(_UpdateUserRequestModel value, $Res Function(_UpdateUserRequestModel) _then) = __$UpdateUserRequestModelCopyWithImpl;
@override @useResult
$Res call({
String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone
});
}
/// @nodoc
class __$UpdateUserRequestModelCopyWithImpl<$Res>
implements _$UpdateUserRequestModelCopyWith<$Res> {
__$UpdateUserRequestModelCopyWithImpl(this._self, this._then);
final _UpdateUserRequestModel _self;
final $Res Function(_UpdateUserRequestModel) _then;
/// Create a copy of UpdateUserRequestModel
/// 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 = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) {
return _then(_UpdateUserRequestModel(
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: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,45 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'update_user_request_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_UpdateUserRequestModel _$UpdateUserRequestModelFromJson(
Map<String, dynamic> json,
) => _UpdateUserRequestModel(
id: json['id'] as String,
delegationId: json['delegationId'] as String?,
email: json['email'] as String?,
createdAt: json['createdAt'] as String?,
updatedAt: json['updatedAt'] as String?,
status: json['status'] as String?,
role: json['role'] as String?,
lastLogin: json['lastLogin'] as String?,
currentLogin: json['currentLogin'] as String?,
language: json['language'] as String?,
firstName: json['firstName'] as String?,
lastName: json['lastName'] as String?,
hasApiKey: json['hasApiKey'] as String?,
phone: json['phone'] as String?,
);
Map<String, dynamic> _$UpdateUserRequestModelToJson(
_UpdateUserRequestModel 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,
};

View File

@@ -1,6 +1,8 @@
import 'package:account/src/core/data/datasource/account_remote_datasource.dart';
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/user_entity.dart';
class AccountRepositoryImpl implements AccountRepository {
const AccountRepositoryImpl(this._remote);
@@ -11,4 +13,14 @@ class AccountRepositoryImpl implements AccountRepository {
Future<List<DeviceEntity>> getLinkedDevices({required String userId}) {
return _remote.getLinkedDevices(userId: userId);
}
@override
Future<UserEntity> getLoggedUser({required String token}) {
return _remote.getLoggedUser(token: token);
}
@override
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request}) {
return _remote.updateUser(userId: userId, request: request);
}
}

View File

@@ -1,5 +1,11 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/user_entity.dart';
abstract class AccountRepository {
Future<List<DeviceEntity>> getLinkedDevices({required String userId});
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request});
Future<UserEntity> getLoggedUser({required String token});
}

View File

@@ -1,9 +1,9 @@
import 'package:account/src/core/data/datasource/account_remote_datasource.dart';
import 'package:account/src/core/data/datasource/account_remote_datasource_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
// import 'package:sf_infrastructure/sf_infrastructure.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
final accountRemoteDatasourceProvider = Provider<AccountRemoteDatasource>((ref) {
// final questiaRepository = getIt<QuestiaRepository>();
return AccountRemoteDatasourceImpl(/*questiaRepository*/);
final questiaRepository = getIt<QuestiaRepository>();
return AccountRemoteDatasourceImpl(questiaRepository);
});

View File

@@ -1,4 +1,4 @@
import 'package:account/src/features/linked_devices/presentation/linked_devices_screen.dart';
// import 'package:account/src/features/linked_devices/presentation/linked_devices_screen.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
@@ -48,7 +48,7 @@ class AccountSettingsScreen extends ConsumerWidget {
child: Column(
children: [
AppSectionButton(
onPressed: (){},
onPressed: (){navigationContract.pushTo(AppRoutes.personalData);},
icon: SFIcons.account,
text: 'Personal Data'
),
@@ -60,10 +60,7 @@ class AccountSettingsScreen extends ConsumerWidget {
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){Navigator.push(
context,
MaterialPageRoute(builder: (_) => LinkedDevicesScreen(navigationContract: navigationContract)),
);},
onPressed: (){navigationContract.pushTo(AppRoutes.linkedDevices);},
icon: Icons.account_circle_outlined,
text: 'Linked Devices'
),

View File

@@ -0,0 +1,4 @@
abstract class UpdateDeviceUseCase {
Future<void> updateDevice({required String userId});
}

View File

@@ -0,0 +1,15 @@
import 'package:account/src/core/domain/repositories/account_repository.dart';
// import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
// import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart';
import 'package:account/src/features/linked_devices/domain/update_device_use_case.dart';
class UpdateDeviceUseCaseImpl implements UpdateDeviceUseCase {
UpdateDeviceUseCaseImpl(this._repository);
final AccountRepository _repository;
@override
Future<void> updateDevice({required String userId}) async {
/*return _repository.updateDevice(userId: userId);*/
}
}

View File

@@ -0,0 +1,19 @@
// import 'package:account/src/features/account_settings/presentation/account_settings_screen.dart';
import 'package:account/src/features/linked_devices/presentation/linked_devices_screen.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:get_it/get_it.dart';
import 'package:navigation/navigation.dart';
class LinkedDevicesBuilder {
const LinkedDevicesBuilder();
Page<void> buildPage(BuildContext context, GoRouterState state) {
final NavigationContract navigationContract = GetIt.I<NavigationContract>();
return MaterialPage<void>(
key: state.pageKey,
child: LinkedDevicesScreen(navigationContract: navigationContract),
);
}
}

View File

@@ -1,4 +1,5 @@
import 'package:account/src/features/linked_devices/state/linked_devices_view_model.dart';
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
@@ -9,9 +10,9 @@ import 'package:utils/utils.dart';
class EditLinkedDeviceScreen extends ConsumerWidget {
//final NavigationContract navigationContract;
final String deviceName;
final DeviceEntity device;
const EditLinkedDeviceScreen({super.key, required this.deviceName /*required this.navigationContract*/});
const EditLinkedDeviceScreen({super.key, required this.device /*required this.navigationContract*/});
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -45,10 +46,10 @@ class EditLinkedDeviceScreen extends ConsumerWidget {
),
),
SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)),
Container(
Expanded(child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
small: EdgeInsets.symmetric(horizontal: 48, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 47, vertical: 8)
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -82,15 +83,21 @@ class EditLinkedDeviceScreen extends ConsumerWidget {
))
],
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.deviceNameController,
hint: deviceName,
hint: device.name,
label: 'Name',
)
],
),
PrimaryButton(text: 'Save', color: Color(0xFF588EA5))
PrimaryButton(
onPressed: (){vm.updateDevice(device);},
text: 'Save',
color: Color(0xFF588EA5)
)
],
)
))
),
],
)

View File

@@ -1,5 +1,6 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/presentation/edit_linked_device_screen.dart';
import 'package:account/src/features/linked_devices/state/linked_devices_view_model.dart';
import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
@@ -68,8 +69,7 @@ class LinkedDevicesScreen extends ConsumerWidget {
),
child: ListView.separated(
itemBuilder: (BuildContext context, int index)=>LinkedDeviceCard(
name: state.linkedDevices[index].name,
body: state.linkedDevices[index].number,
device: state.linkedDevices[index],
isEditing: state.isEditing,
),
separatorBuilder: (BuildContext context, int index)=>SizedBox(
@@ -87,13 +87,11 @@ class LinkedDevicesScreen extends ConsumerWidget {
class LinkedDeviceCard extends ConsumerWidget {
final String name;
final String body;
final DeviceEntity device;
final bool isEditing;
const LinkedDeviceCard({
required this.name,
required this.body,
required this.device,
required this.isEditing,
});
@@ -129,13 +127,13 @@ class LinkedDeviceCard extends ConsumerWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(name,
Text(device.name,
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 18, big: 19),
fontWeight: FontWeight.w500
)
),
Text(body,
Text(device.number,
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 14, big: 13),
)
@@ -208,7 +206,7 @@ class LinkedDeviceCard extends ConsumerWidget {
onPressed: (){Navigator.push(
context,
MaterialPageRoute(builder: (_) => EditLinkedDeviceScreen(
deviceName: name,
device: device,
/*navigationContract: navigationContract*/
)),
);},

View File

@@ -0,0 +1,9 @@
import 'package:account/src/core/providers/account_repository_provider.dart';
import 'package:account/src/features/linked_devices/domain/update_device_use_case.dart';
import 'package:account/src/features/linked_devices/domain/update_device_use_case_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final updateDeviceUseCaseProvider = Provider.autoDispose<UpdateDeviceUseCase>((ref) {
final authRepository = ref.read(accountRepositoryProvider);
return UpdateDeviceUseCaseImpl(authRepository);
});

View File

@@ -1,7 +1,9 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart';
import 'package:account/src/features/linked_devices/domain/update_device_use_case.dart';
import 'package:account/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart';
import 'package:account/src/features/linked_devices/state/linked_devices_view_state.dart';
import 'package:account/src/features/linked_devices/presentation/providers/update_device_use_case_provider.dart';
import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_state.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
// import 'package:sf_localizations/sf_localizations.dart';
@@ -13,12 +15,14 @@ NotifierProvider.autoDispose<LinkedDevicesViewModel, LinkedDevicesViewState>(
class LinkedDevicesViewModel extends Notifier<LinkedDevicesViewState> {
late final GetLinkedDevicesUseCase _getLinkedDevicesUseCase;
late final UpdateDeviceUseCase _updateDeviceUseCase;
late final TextEditingController deviceNameController;
@override
LinkedDevicesViewState build() {
_getLinkedDevicesUseCase = ref.read(getLinkedDevicesUseCaseProvider);
_updateDeviceUseCase = ref.read(updateDeviceUseCaseProvider);
deviceNameController = TextEditingController();
deviceNameController.addListener(_onDeviceNameChanged);
@@ -49,6 +53,19 @@ class LinkedDevicesViewModel extends Notifier<LinkedDevicesViewState> {
);
}
void updateDevice(DeviceEntity device) {
final deviceName = state.deviceName;
if (deviceName.isEmpty) {
state = state.copyWith(
errorMessage: ''
);
return;
}
}
void disposeControllers() {
deviceNameController.removeListener(_onDeviceNameChanged);
deviceNameController.dispose();

View File

@@ -9,6 +9,7 @@ abstract class LinkedDevicesViewState with _$LinkedDevicesViewState {
@Default(false) bool isLoading,
@Default([]) List<DeviceEntity> linkedDevices,
@Default(false) bool isEditing,
@Default('') String deviceName
@Default('') String deviceName,
@Default('') String errorMessage
}) = _LinkedDevicesViewState;
}

View File

@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$LinkedDevicesViewState {
bool get isLoading; List<DeviceEntity> get linkedDevices; bool get isEditing; String get deviceName;
bool get isLoading; List<DeviceEntity> get linkedDevices; bool get isEditing; String get deviceName; String get errorMessage;
/// Create a copy of LinkedDevicesViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -25,16 +25,16 @@ $LinkedDevicesViewStateCopyWith<LinkedDevicesViewState> get copyWith => _$Linked
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is LinkedDevicesViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other.linkedDevices, linkedDevices)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName));
return identical(this, other) || (other.runtimeType == runtimeType&&other is LinkedDevicesViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other.linkedDevices, linkedDevices)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(linkedDevices),isEditing,deviceName);
int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(linkedDevices),isEditing,deviceName,errorMessage);
@override
String toString() {
return 'LinkedDevicesViewState(isLoading: $isLoading, linkedDevices: $linkedDevices, isEditing: $isEditing, deviceName: $deviceName)';
return 'LinkedDevicesViewState(isLoading: $isLoading, linkedDevices: $linkedDevices, isEditing: $isEditing, deviceName: $deviceName, errorMessage: $errorMessage)';
}
@@ -45,7 +45,7 @@ abstract mixin class $LinkedDevicesViewStateCopyWith<$Res> {
factory $LinkedDevicesViewStateCopyWith(LinkedDevicesViewState value, $Res Function(LinkedDevicesViewState) _then) = _$LinkedDevicesViewStateCopyWithImpl;
@useResult
$Res call({
bool isLoading, List<DeviceEntity> linkedDevices, bool isEditing, String deviceName
bool isLoading, List<DeviceEntity> linkedDevices, bool isEditing, String deviceName, String errorMessage
});
@@ -62,12 +62,13 @@ class _$LinkedDevicesViewStateCopyWithImpl<$Res>
/// Create a copy of LinkedDevicesViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? linkedDevices = null,Object? isEditing = null,Object? deviceName = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? linkedDevices = null,Object? isEditing = null,Object? deviceName = null,Object? errorMessage = null,}) {
return _then(_self.copyWith(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,linkedDevices: null == linkedDevices ? _self.linkedDevices : linkedDevices // ignore: cast_nullable_to_non_nullable
as List<DeviceEntity>,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable
as bool,deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
@@ -153,10 +154,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, List<DeviceEntity> linkedDevices, bool isEditing, String deviceName)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, List<DeviceEntity> linkedDevices, bool isEditing, String deviceName, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _LinkedDevicesViewState() when $default != null:
return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName);case _:
return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName,_that.errorMessage);case _:
return orElse();
}
@@ -174,10 +175,10 @@ return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.device
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, List<DeviceEntity> linkedDevices, bool isEditing, String deviceName) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, List<DeviceEntity> linkedDevices, bool isEditing, String deviceName, String errorMessage) $default,) {final _that = this;
switch (_that) {
case _LinkedDevicesViewState():
return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName);case _:
return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName,_that.errorMessage);case _:
throw StateError('Unexpected subclass');
}
@@ -194,10 +195,10 @@ return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.device
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, List<DeviceEntity> linkedDevices, bool isEditing, String deviceName)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, List<DeviceEntity> linkedDevices, bool isEditing, String deviceName, String errorMessage)? $default,) {final _that = this;
switch (_that) {
case _LinkedDevicesViewState() when $default != null:
return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName);case _:
return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName,_that.errorMessage);case _:
return null;
}
@@ -209,7 +210,7 @@ return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.device
class _LinkedDevicesViewState implements LinkedDevicesViewState {
const _LinkedDevicesViewState({this.isLoading = false, final List<DeviceEntity> linkedDevices = const [], this.isEditing = false, this.deviceName = ''}): _linkedDevices = linkedDevices;
const _LinkedDevicesViewState({this.isLoading = false, final List<DeviceEntity> linkedDevices = const [], this.isEditing = false, this.deviceName = '', this.errorMessage = ''}): _linkedDevices = linkedDevices;
@override@JsonKey() final bool isLoading;
@@ -222,6 +223,7 @@ class _LinkedDevicesViewState implements LinkedDevicesViewState {
@override@JsonKey() final bool isEditing;
@override@JsonKey() final String deviceName;
@override@JsonKey() final String errorMessage;
/// Create a copy of LinkedDevicesViewState
/// with the given fields replaced by the non-null parameter values.
@@ -233,16 +235,16 @@ _$LinkedDevicesViewStateCopyWith<_LinkedDevicesViewState> get copyWith => __$Lin
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LinkedDevicesViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other._linkedDevices, _linkedDevices)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LinkedDevicesViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other._linkedDevices, _linkedDevices)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(_linkedDevices),isEditing,deviceName);
int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(_linkedDevices),isEditing,deviceName,errorMessage);
@override
String toString() {
return 'LinkedDevicesViewState(isLoading: $isLoading, linkedDevices: $linkedDevices, isEditing: $isEditing, deviceName: $deviceName)';
return 'LinkedDevicesViewState(isLoading: $isLoading, linkedDevices: $linkedDevices, isEditing: $isEditing, deviceName: $deviceName, errorMessage: $errorMessage)';
}
@@ -253,7 +255,7 @@ abstract mixin class _$LinkedDevicesViewStateCopyWith<$Res> implements $LinkedDe
factory _$LinkedDevicesViewStateCopyWith(_LinkedDevicesViewState value, $Res Function(_LinkedDevicesViewState) _then) = __$LinkedDevicesViewStateCopyWithImpl;
@override @useResult
$Res call({
bool isLoading, List<DeviceEntity> linkedDevices, bool isEditing, String deviceName
bool isLoading, List<DeviceEntity> linkedDevices, bool isEditing, String deviceName, String errorMessage
});
@@ -270,12 +272,13 @@ class __$LinkedDevicesViewStateCopyWithImpl<$Res>
/// Create a copy of LinkedDevicesViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? linkedDevices = null,Object? isEditing = null,Object? deviceName = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? linkedDevices = null,Object? isEditing = null,Object? deviceName = null,Object? errorMessage = null,}) {
return _then(_LinkedDevicesViewState(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,linkedDevices: null == linkedDevices ? _self._linkedDevices : linkedDevices // ignore: cast_nullable_to_non_nullable
as List<DeviceEntity>,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable
as bool,deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}

View File

@@ -0,0 +1,23 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'update_user_request_entity.freezed.dart';
@freezed
abstract class UpdateUserRequestEntity with _$UpdateUserRequestEntity {
const factory UpdateUserRequestEntity({
required String id,
String? delegationId,
String? email,
String? createdAt,
String? updatedAt,
String? status,
String? role,
String? lastLogin,
String? currentLogin,
String? language,
String? firstName,
String? lastName,
String? hasApiKey,
String? phone,
}) = _UpdateUserRequestEntity;
}

View File

@@ -0,0 +1,310 @@
// 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 'update_user_request_entity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$UpdateUserRequestEntity {
String get id; String? get delegationId; String? get email; String? get createdAt; String? get updatedAt; String? get status; String? get role; String? get lastLogin; String? get currentLogin; String? get language; String? get firstName; String? get lastName; String? get hasApiKey; String? get phone;
/// Create a copy of UpdateUserRequestEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$UpdateUserRequestEntityCopyWith<UpdateUserRequestEntity> get copyWith => _$UpdateUserRequestEntityCopyWithImpl<UpdateUserRequestEntity>(this as UpdateUserRequestEntity, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateUserRequestEntity&&(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 'UpdateUserRequestEntity(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 $UpdateUserRequestEntityCopyWith<$Res> {
factory $UpdateUserRequestEntityCopyWith(UpdateUserRequestEntity value, $Res Function(UpdateUserRequestEntity) _then) = _$UpdateUserRequestEntityCopyWithImpl;
@useResult
$Res call({
String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone
});
}
/// @nodoc
class _$UpdateUserRequestEntityCopyWithImpl<$Res>
implements $UpdateUserRequestEntityCopyWith<$Res> {
_$UpdateUserRequestEntityCopyWithImpl(this._self, this._then);
final UpdateUserRequestEntity _self;
final $Res Function(UpdateUserRequestEntity) _then;
/// Create a copy of UpdateUserRequestEntity
/// 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 = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) {
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: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// Adds pattern-matching-related methods to [UpdateUserRequestEntity].
extension UpdateUserRequestEntityPatterns on UpdateUserRequestEntity {
/// 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( _UpdateUserRequestEntity value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _UpdateUserRequestEntity() 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( _UpdateUserRequestEntity value) $default,){
final _that = this;
switch (_that) {
case _UpdateUserRequestEntity():
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( _UpdateUserRequestEntity value)? $default,){
final _that = this;
switch (_that) {
case _UpdateUserRequestEntity() 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, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _UpdateUserRequestEntity() 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, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone) $default,) {final _that = this;
switch (_that) {
case _UpdateUserRequestEntity():
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, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,) {final _that = this;
switch (_that) {
case _UpdateUserRequestEntity() 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 _UpdateUserRequestEntity implements UpdateUserRequestEntity {
const _UpdateUserRequestEntity({required this.id, this.delegationId, this.email, this.createdAt, this.updatedAt, this.status, this.role, this.lastLogin, this.currentLogin, this.language, this.firstName, this.lastName, this.hasApiKey, this.phone});
@override final String id;
@override final String? delegationId;
@override final String? email;
@override final String? createdAt;
@override final String? updatedAt;
@override final String? status;
@override final String? role;
@override final String? lastLogin;
@override final String? currentLogin;
@override final String? language;
@override final String? firstName;
@override final String? lastName;
@override final String? hasApiKey;
@override final String? phone;
/// Create a copy of UpdateUserRequestEntity
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$UpdateUserRequestEntityCopyWith<_UpdateUserRequestEntity> get copyWith => __$UpdateUserRequestEntityCopyWithImpl<_UpdateUserRequestEntity>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateUserRequestEntity&&(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 'UpdateUserRequestEntity(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 _$UpdateUserRequestEntityCopyWith<$Res> implements $UpdateUserRequestEntityCopyWith<$Res> {
factory _$UpdateUserRequestEntityCopyWith(_UpdateUserRequestEntity value, $Res Function(_UpdateUserRequestEntity) _then) = __$UpdateUserRequestEntityCopyWithImpl;
@override @useResult
$Res call({
String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone
});
}
/// @nodoc
class __$UpdateUserRequestEntityCopyWithImpl<$Res>
implements _$UpdateUserRequestEntityCopyWith<$Res> {
__$UpdateUserRequestEntityCopyWithImpl(this._self, this._then);
final _UpdateUserRequestEntity _self;
final $Res Function(_UpdateUserRequestEntity) _then;
/// Create a copy of UpdateUserRequestEntity
/// 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 = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) {
return _then(_UpdateUserRequestEntity(
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: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,23 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'user_entity.freezed.dart';
@freezed
abstract class UserEntity with _$UserEntity {
const factory UserEntity({
required String id,
required String delegationId,
required String email,
required String createdAt,
required String updatedAt,
required String status,
required String role,
required String lastLogin,
required String currentLogin,
required String language,
required String firstName,
required String lastName,
required String hasApiKey,
required String phone,
}) = _UserEntity;
}

View File

@@ -0,0 +1,310 @@
// 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; String get createdAt; String get updatedAt; String get status; String get role; String get lastLogin; String get currentLogin; String get language; String get firstName; String get lastName; String 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, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String 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 = null,Object? email = null,Object? createdAt = null,Object? updatedAt = null,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: null == 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 String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String,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 String,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String,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 String,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, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String 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, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String 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, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String 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, required this.delegationId, required this.email, required this.createdAt, required 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 String createdAt;
@override final String updatedAt;
@override final String status;
@override final String role;
@override final String lastLogin;
@override final String currentLogin;
@override final String language;
@override final String firstName;
@override final String lastName;
@override final String 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, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String 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 = null,Object? email = null,Object? createdAt = null,Object? updatedAt = null,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: null == 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 String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String,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 String,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String,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 String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -0,0 +1,5 @@
import 'package:account/src/features/personal_data/domain/entities/user_entity.dart';
abstract class GetLoggedUserUseCase {
Future<UserEntity> getLoggedUser({required String token});
}

View File

@@ -0,0 +1,13 @@
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/personal_data/domain/entities/user_entity.dart';
import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart';
class GetLoggedUserUseCaseImpl implements GetLoggedUserUseCase {
GetLoggedUserUseCaseImpl(this._repository);
final AccountRepository _repository;
@override
Future<UserEntity> getLoggedUser({required String token}) {
return _repository.getLoggedUser(token: token);
}
}

View File

@@ -0,0 +1,5 @@
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
abstract class UpdateUserUseCase {
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request});
}

View File

@@ -0,0 +1,13 @@
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:account/src/features/personal_data/domain/update_user_use_case.dart';
class UpdateUserUseCaseImpl implements UpdateUserUseCase {
UpdateUserUseCaseImpl(this._repository);
final AccountRepository _repository;
@override
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request}) {
return _repository.updateUser(userId: userId, request: request);
}
}

View File

@@ -0,0 +1,19 @@
// import 'package:account/src/features/account_settings/presentation/account_settings_screen.dart';
import 'package:account/src/features/personal_data/presentation/personal_data_screen.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:get_it/get_it.dart';
import 'package:navigation/navigation.dart';
class PersonalDataBuilder {
const PersonalDataBuilder();
Page<void> buildPage(BuildContext context, GoRouterState state) {
final NavigationContract navigationContract = GetIt.I<NavigationContract>();
return MaterialPage<void>(
key: state.pageKey,
child: PersonalDataScreen(navigationContract: navigationContract),
);
}
}

View File

@@ -0,0 +1,132 @@
import 'package:account/src/features/personal_data/presentation/state/personal_data_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
class PersonalDataScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const PersonalDataScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final vm = ref.read(personalDataViewModelProvider.notifier);
final state = ref.watch(personalDataViewModelProvider);
final theme = ref.watch(themePortProvider);
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: SafeArea(
child: Column(
children: [
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Stack(
children: [
IconButton(onPressed: () {Navigator.pop(context);},
icon: Icon(Icons.arrow_back)),
Center(
child: Text(context.translate('Personal data'),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
),
)
)
],
),
),
SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)),
Expanded(child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 48, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 47, vertical: 8)
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: SingleChildScrollView(child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Stack(
children: [
Center(child: SvgPicture.asset('assets/images/ui/profile.svg')),
Center(child: SizedBox(
width: 160,
height: 160,
child: Align(alignment: Alignment.bottomRight,
child: IconButton(
onPressed: (){},
icon: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFFCAC9C9)
),
padding: EdgeInsets.all(8),
child: Icon(
Icons.edit_outlined,
color: Colors.white,
size: SizeUtils.getByScreen(small: 32, big: 30),
),
),
)
)
))
],
),
SizedBox(height: SizeUtils.getByScreen(small: 18, big: 16)),
Text('(Login email)',
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 14, big: 13))
),
Text(state.user?.email ?? '',
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 18, big: 17))
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.nameController,
hint: state.user?.firstName ?? '',
label: 'Name',
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.phoneController,
hint: state.user?.phone ?? '',
label: 'Phone number',
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.emailController,
hint: state.user?.email ?? '',
label: 'Email',
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.passwordController,
showPassword: state.showPassword,
hint: '********',
label: 'Password (6 to 12 digits)',
),
],
))),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
PrimaryButton(
onPressed: vm.updateUser,
text: 'Submit',
color: Color(0xFF588EA5)
)
],
))
),
],
)
),
);
}
}

View File

@@ -0,0 +1,9 @@
import 'package:account/src/core/providers/account_repository_provider.dart';
import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart';
import 'package:account/src/features/personal_data/domain/get_logged_user_use_case_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final getLoggedUserUseCaseProvider = Provider.autoDispose<GetLoggedUserUseCase>((ref) {
final authRepository = ref.read(accountRepositoryProvider);
return GetLoggedUserUseCaseImpl(authRepository);
});

View File

@@ -0,0 +1,9 @@
import 'package:account/src/core/providers/account_repository_provider.dart';
import 'package:account/src/features/personal_data/domain/update_user_use_case.dart';
import 'package:account/src/features/personal_data/domain/update_user_use_case_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final updateUserUseCaseProvider = Provider.autoDispose<UpdateUserUseCase>((ref) {
final authRepository = ref.read(accountRepositoryProvider);
return UpdateUserUseCaseImpl(authRepository);
});

View File

@@ -0,0 +1,155 @@
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/user_entity.dart';
import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart';
import 'package:account/src/features/personal_data/domain/update_user_use_case.dart';
import 'package:account/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart';
import 'package:account/src/features/personal_data/presentation/providers/update_user_use_case_provider.dart';
import 'package:account/src/features/personal_data/presentation/state/personal_data_view_state.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
// import 'package:sf_localizations/sf_localizations.dart';
final personalDataViewModelProvider =
NotifierProvider.autoDispose<PersonalDataViewModel, PersonalDataViewState>(
PersonalDataViewModel.new,
);
class PersonalDataViewModel extends Notifier<PersonalDataViewState> {
late final GetLoggedUserUseCase _getUserUseCase;
late final UpdateUserUseCase _updateUserUseCase;
late final TextEditingController nameController;
late final TextEditingController emailController;
late final TextEditingController phoneController;
late final TextEditingController passwordController;
@override
PersonalDataViewState build() {
_getUserUseCase = ref.read(getLoggedUserUseCaseProvider);
_updateUserUseCase = ref.read(updateUserUseCaseProvider);
nameController = TextEditingController();
nameController.addListener(_onNameChanged);
emailController = TextEditingController();
emailController.addListener(_onEmailChanged);
phoneController = TextEditingController();
phoneController.addListener(_onPhoneChanged);
passwordController = TextEditingController();
passwordController.addListener(_onPasswordChanged);
_getUserUseCase.getLoggedUser(token: 'test')
.then(setUser);
ref.onDispose(disposeControllers);
return const PersonalDataViewState();
}
void setUser(UserEntity user) {
state = state.copyWith(user: user);
}
void _onNameChanged() {
final value = nameController.text;
if (value == state.name) return;
state = state.copyWith(
name: value,
);
}
void _onEmailChanged() {
final value = emailController.text;
if (value == state.email) return;
state = state.copyWith(
email: value,
);
}
void _onPhoneChanged() {
final value = phoneController.text;
if (value == state.phoneNumber) return;
state = state.copyWith(
phoneNumber: value,
);
}
void _onPasswordChanged() {
final value = passwordController.text;
if (value == state.password) return;
state = state.copyWith(
password: value,
);
}
bool _validateForm() {
if (state.name.trim().isEmpty &&
state.email.trim().isEmpty &&
state.phoneNumber.trim().isEmpty &&
state.password.trim().isEmpty) {
state = state.copyWith(errorMessage: 'errorMessageAllFieldsAreEmpty');
return false;
}
return true;
}
UpdateUserRequestEntity _toRequest() {
return UpdateUserRequestEntity(
id: state.user!.id,
//name: state.name.trim(),
email: state.email.trim(),
phone: /*state.dialCode.trim() + */state.phoneNumber.trim(),
);
}
Future<bool> updateUser() async {
if (state.isLoading) return false;
if (!_validateForm()) return false;
try {
final request = _toRequest();
_updateUserUseCase.updateUser(userId: state.user!.id, request: request);
return true;
} catch (e) {
if (!ref.mounted) return false;
_finishWithError(message: e.toString());
return false;
}
}
void _finishWithError({required String message}) {
state = state.copyWith(
isLoading: false,
errorMessage: message,
);
}
void disposeControllers() {
nameController.removeListener(_onNameChanged);
nameController.dispose();
emailController.removeListener(_onEmailChanged);
emailController.dispose();
phoneController.removeListener(_onPhoneChanged);
phoneController.dispose();
passwordController.removeListener(_onPasswordChanged);
passwordController.dispose();
}
}

View File

@@ -0,0 +1,18 @@
import 'package:account/src/features/personal_data/domain/entities/user_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'personal_data_view_state.freezed.dart';
@freezed
abstract class PersonalDataViewState with _$PersonalDataViewState {
const factory PersonalDataViewState({
@Default(true) bool isLoading,
@Default(null) UserEntity? user,
@Default('') String name,
@Default('') String phoneNumber,
@Default('') String email,
@Default('') String password,
@Default(false) bool showPassword,
@Default('') String errorMessage
}) = _PersonalDataViewState;
}

View File

@@ -0,0 +1,316 @@
// 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 'personal_data_view_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$PersonalDataViewState {
bool get isLoading; UserEntity? get user; String get name; String get phoneNumber; String get email; String get password; bool get showPassword; String get errorMessage;
/// Create a copy of PersonalDataViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$PersonalDataViewStateCopyWith<PersonalDataViewState> get copyWith => _$PersonalDataViewStateCopyWithImpl<PersonalDataViewState>(this as PersonalDataViewState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is PersonalDataViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.user, user) || other.user == user)&&(identical(other.name, name) || other.name == name)&&(identical(other.phoneNumber, phoneNumber) || other.phoneNumber == phoneNumber)&&(identical(other.email, email) || other.email == email)&&(identical(other.password, password) || other.password == password)&&(identical(other.showPassword, showPassword) || other.showPassword == showPassword)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,isLoading,user,name,phoneNumber,email,password,showPassword,errorMessage);
@override
String toString() {
return 'PersonalDataViewState(isLoading: $isLoading, user: $user, name: $name, phoneNumber: $phoneNumber, email: $email, password: $password, showPassword: $showPassword, errorMessage: $errorMessage)';
}
}
/// @nodoc
abstract mixin class $PersonalDataViewStateCopyWith<$Res> {
factory $PersonalDataViewStateCopyWith(PersonalDataViewState value, $Res Function(PersonalDataViewState) _then) = _$PersonalDataViewStateCopyWithImpl;
@useResult
$Res call({
bool isLoading, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage
});
$UserEntityCopyWith<$Res>? get user;
}
/// @nodoc
class _$PersonalDataViewStateCopyWithImpl<$Res>
implements $PersonalDataViewStateCopyWith<$Res> {
_$PersonalDataViewStateCopyWithImpl(this._self, this._then);
final PersonalDataViewState _self;
final $Res Function(PersonalDataViewState) _then;
/// Create a copy of PersonalDataViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? user = freezed,Object? name = null,Object? phoneNumber = null,Object? email = null,Object? password = null,Object? showPassword = null,Object? errorMessage = null,}) {
return _then(_self.copyWith(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
as UserEntity?,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,phoneNumber: null == phoneNumber ? _self.phoneNumber : phoneNumber // ignore: cast_nullable_to_non_nullable
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String,showPassword: null == showPassword ? _self.showPassword : showPassword // ignore: cast_nullable_to_non_nullable
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of PersonalDataViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserEntityCopyWith<$Res>? get user {
if (_self.user == null) {
return null;
}
return $UserEntityCopyWith<$Res>(_self.user!, (value) {
return _then(_self.copyWith(user: value));
});
}
}
/// Adds pattern-matching-related methods to [PersonalDataViewState].
extension PersonalDataViewStatePatterns on PersonalDataViewState {
/// 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( _PersonalDataViewState value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _PersonalDataViewState() 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( _PersonalDataViewState value) $default,){
final _that = this;
switch (_that) {
case _PersonalDataViewState():
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( _PersonalDataViewState value)? $default,){
final _that = this;
switch (_that) {
case _PersonalDataViewState() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _PersonalDataViewState() when $default != null:
return $default(_that.isLoading,_that.user,_that.name,_that.phoneNumber,_that.email,_that.password,_that.showPassword,_that.errorMessage);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage) $default,) {final _that = this;
switch (_that) {
case _PersonalDataViewState():
return $default(_that.isLoading,_that.user,_that.name,_that.phoneNumber,_that.email,_that.password,_that.showPassword,_that.errorMessage);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage)? $default,) {final _that = this;
switch (_that) {
case _PersonalDataViewState() when $default != null:
return $default(_that.isLoading,_that.user,_that.name,_that.phoneNumber,_that.email,_that.password,_that.showPassword,_that.errorMessage);case _:
return null;
}
}
}
/// @nodoc
class _PersonalDataViewState implements PersonalDataViewState {
const _PersonalDataViewState({this.isLoading = true, this.user = null, this.name = '', this.phoneNumber = '', this.email = '', this.password = '', this.showPassword = false, this.errorMessage = ''});
@override@JsonKey() final bool isLoading;
@override@JsonKey() final UserEntity? user;
@override@JsonKey() final String name;
@override@JsonKey() final String phoneNumber;
@override@JsonKey() final String email;
@override@JsonKey() final String password;
@override@JsonKey() final bool showPassword;
@override@JsonKey() final String errorMessage;
/// Create a copy of PersonalDataViewState
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$PersonalDataViewStateCopyWith<_PersonalDataViewState> get copyWith => __$PersonalDataViewStateCopyWithImpl<_PersonalDataViewState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PersonalDataViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.user, user) || other.user == user)&&(identical(other.name, name) || other.name == name)&&(identical(other.phoneNumber, phoneNumber) || other.phoneNumber == phoneNumber)&&(identical(other.email, email) || other.email == email)&&(identical(other.password, password) || other.password == password)&&(identical(other.showPassword, showPassword) || other.showPassword == showPassword)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,isLoading,user,name,phoneNumber,email,password,showPassword,errorMessage);
@override
String toString() {
return 'PersonalDataViewState(isLoading: $isLoading, user: $user, name: $name, phoneNumber: $phoneNumber, email: $email, password: $password, showPassword: $showPassword, errorMessage: $errorMessage)';
}
}
/// @nodoc
abstract mixin class _$PersonalDataViewStateCopyWith<$Res> implements $PersonalDataViewStateCopyWith<$Res> {
factory _$PersonalDataViewStateCopyWith(_PersonalDataViewState value, $Res Function(_PersonalDataViewState) _then) = __$PersonalDataViewStateCopyWithImpl;
@override @useResult
$Res call({
bool isLoading, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage
});
@override $UserEntityCopyWith<$Res>? get user;
}
/// @nodoc
class __$PersonalDataViewStateCopyWithImpl<$Res>
implements _$PersonalDataViewStateCopyWith<$Res> {
__$PersonalDataViewStateCopyWithImpl(this._self, this._then);
final _PersonalDataViewState _self;
final $Res Function(_PersonalDataViewState) _then;
/// Create a copy of PersonalDataViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? user = freezed,Object? name = null,Object? phoneNumber = null,Object? email = null,Object? password = null,Object? showPassword = null,Object? errorMessage = null,}) {
return _then(_PersonalDataViewState(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
as UserEntity?,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,phoneNumber: null == phoneNumber ? _self.phoneNumber : phoneNumber // ignore: cast_nullable_to_non_nullable
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String,showPassword: null == showPassword ? _self.showPassword : showPassword // ignore: cast_nullable_to_non_nullable
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of PersonalDataViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserEntityCopyWith<$Res>? get user {
if (_self.user == null) {
return null;
}
return $UserEntityCopyWith<$Res>(_self.user!, (value) {
return _then(_self.copyWith(user: value));
});
}
}
// dart format on

View File

@@ -87,7 +87,7 @@
"width": 1000
},
"search": [
"icon"
"functions"
]
},
{

View File

@@ -18,6 +18,9 @@ class AppRoutes {
static const legacy = '/legacy';
static const accountSettings = '$legacy/account_settings';
static const personalData = '$accountSettings/personal_data';
static const linkedDevices = '$accountSettings/linked_devices';
static const legacyDashboard = '$legacy/dashboard';
static const dashboardHub = '$legacyDashboard/hub';