create legacy_shared package and added page_layout and logged_user_provider

This commit is contained in:
2026-02-10 17:30:58 +01:00
parent 3283494cb1
commit da90ed94ea
17 changed files with 1426 additions and 0 deletions

1
.idea/modules.xml generated
View File

@@ -13,6 +13,7 @@
<module fileurl="file://$PROJECT_DIR$/modules/legacy/modules/hub/melos_hub.iml" filepath="$PROJECT_DIR$/modules/legacy/modules/hub/melos_hub.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/legacy/melos_legacy.iml" filepath="$PROJECT_DIR$/modules/legacy/melos_legacy.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/legacy/modules/legacy_dashboard_shell/melos_legacy_dashboard_shell.iml" filepath="$PROJECT_DIR$/modules/legacy/modules/legacy_dashboard_shell/melos_legacy_dashboard_shell.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/legacy/packages/legacy_shared/melos_legacy_shared.iml" filepath="$PROJECT_DIR$/modules/legacy/packages/legacy_shared/melos_legacy_shared.iml" />
<module fileurl="file://$PROJECT_DIR$/packages/navigation/melos_navigation.iml" filepath="$PROJECT_DIR$/packages/navigation/melos_navigation.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/notifications/melos_notifications.iml" filepath="$PROJECT_DIR$/modules/notifications/melos_notifications.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/profile/melos_profile.iml" filepath="$PROJECT_DIR$/modules/profile/melos_profile.iml" />

View File

@@ -20,6 +20,9 @@
<excludeFolder url="file://$MODULE_DIR$/modules/functions/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/modules/functions/.pub" />
<excludeFolder url="file://$MODULE_DIR$/modules/functions/build" />
<excludeFolder url="file://$MODULE_DIR$/packages/legacy_shared/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/packages/legacy_shared/.pub" />
<excludeFolder url="file://$MODULE_DIR$/packages/legacy_shared/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />

View File

@@ -0,0 +1,114 @@
name: functions
description: "A new Flutter project."
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
#
# This version is used _only_ for the Runner app, which is used if you just do
# a `flutter run`. It has no impact on any other native host app that you embed
# your Flutter project into.
version: 1.0.0+1
environment:
sdk: ^3.9.2
dependencies:
flutter:
sdk: flutter
#modules dependencies go here
#packages dependencies go here
design_system:
path: ../../../../packages/design_system
navigation:
path: ../../../../packages/navigation
sf_localizations:
path: ../../../../packages/sf_localizations
sf_infrastructure:
path: ../../../../packages/sf_infrastructure
utils:
path: ../../../../packages/utils
fonts:
path: ../../../../packages/fonts
legacy_shared:
path: ../../packages/legacy_shared
#dependencies go here
flutter_svg: ^2.2.1
get_it: ^9.0.5
go_router: ^17.0.0
flutter_riverpod: ^3.0.3
freezed_annotation: ^3.1.0
freezed: ^3.2.3
dio: ^5.9.0
json_annotation: ^4.9.0
json_serializable: ^6.11.2
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^5.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add Flutter specific assets to your application, add an assets section,
# like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/to/resolution-aware-images
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/to/asset-from-package
# To add Flutter specific custom fonts to your application, add a fonts
# section here, in this "flutter" section. Each entry in this list should
# have a "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/to/font-from-package
# This section identifies your Flutter project as a module meant for
# embedding in a native host app. These identifiers should _not_ ordinarily
# be changed after generation - they are used to ensure that the tooling can
# maintain consistency when adding or modifying assets and plugins.
# They also do not have any bearing on your native host application's
# identifiers, which may be completely independent or the same as these.
module:
androidX: true
androidPackage: com.example.functions
iosBundleIdentifier: com.example.functions

View File

@@ -0,0 +1,5 @@
import 'package:legacy_shared/src/data/models/entities/user_entity.dart';
abstract class LegacySharedRemoteDatasource {
Future<UserEntity> getLoggedUser({required String token});
}

View File

@@ -0,0 +1,75 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:legacy_shared/src/data/datasource/legacy_shared_remote_datasource.dart';
import 'package:legacy_shared/src/data/models/entities/user_entity.dart';
import 'package:legacy_shared/src/data/models/get_logged_user_response_model.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
class LegacySharedRemoteDatasourceImpl implements LegacySharedRemoteDatasource {
LegacySharedRemoteDatasourceImpl(this._repository);
final QuestiaRepository _repository;
@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 = GetLoggedUserResponseModel.fromJson(data);
/*final model = GetLoggedUserResponseModel(item:
GetLoggedUserItemResponseModel(
id: '1111',
firstName: 'Juan',
email: 'juan@test.com',
phone: '111111111'));*/
return model.toEntity();
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: error.message ?? 'Error getting logged user',
);
}
}
}
Exception _mapDioError(DioException error, {required String defaultMessage}) {
final apiMsg = _extractApiMessage(error.response?.data);
final msg = apiMsg ?? error.message ?? defaultMessage;
return Exception(msg);
}
String? _extractApiMessage(Object? data) {
if (data == null) return null;
if (data is Map) {
final errorObj = data['error'];
if (errorObj is Map && errorObj['message'] is String) {
return (errorObj['message'] as String).trim();
}
if (data['message'] is String) {
return (data['message'] as String).trim();
}
return null;
}
if (data is String) {
final raw = data.trim();
if (raw.isEmpty) return null;
try {
final decoded = jsonDecode(raw);
return _extractApiMessage(decoded);
} catch (_) {
return raw;
}
}
return null;
}

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,60 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:legacy_shared/src/data/models/entities/user_entity.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,6 @@
import 'package:legacy_shared/src/data/models/entities/user_entity.dart';
abstract class LegacySharedRepository {
Future<UserEntity> getLoggedUser({required String token});
}

View File

@@ -0,0 +1,15 @@
import 'package:legacy_shared/src/data/datasource/legacy_shared_remote_datasource.dart';
import 'package:legacy_shared/src/data/models/entities/user_entity.dart';
import 'legacy_shared_repository.dart';
class LegacySharedRepositoryImpl implements LegacySharedRepository {
const LegacySharedRepositoryImpl(this._remote);
final LegacySharedRemoteDatasource _remote;
@override
Future<UserEntity> getLoggedUser({required String token}) {
return _remote.getLoggedUser(token: token);
}
}

View File

@@ -0,0 +1,9 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/src/data/datasource/legacy_shared_remote_datasource.dart';
import 'package:legacy_shared/src/data/datasource/legacy_shared_remote_datasource_impl.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
final legacySharedRemoteDatasourceProvider = Provider<LegacySharedRemoteDatasource>((ref) {
final questiaRepository = getIt<QuestiaRepository>();
return LegacySharedRemoteDatasourceImpl(questiaRepository);
});

View File

@@ -0,0 +1,10 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/src/data/repositories/legacy_shared_repository.dart';
import 'package:legacy_shared/src/data/repositories/legacy_shared_repository_impl.dart';
import 'legacy_shared_remote_datasource_provider.dart';
final legacySharedRepositoryProvider = Provider<LegacySharedRepository>((ref) {
final remote = ref.read(legacySharedRemoteDatasourceProvider);
return LegacySharedRepositoryImpl(remote);
});

View File

@@ -0,0 +1,20 @@
import 'dart:async';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/src/data/models/entities/user_entity.dart';
import 'legacy_shared_repository_provider.dart';
final loggedUserProvider = AsyncNotifierProvider.autoDispose<LoggedUserNotifier, UserEntity>(
LoggedUserNotifier.new,
);
class LoggedUserNotifier extends AsyncNotifier<UserEntity> {
late final legacySharedRepository;
@override
FutureOr<UserEntity> build() {
legacySharedRepository = ref.read(legacySharedRepositoryProvider);
return legacySharedRepository.getLoggedUser(token: '');
}
}

View File

@@ -0,0 +1,52 @@
import 'package:flutter/material.dart';
import 'package:utils/src/size_utils.dart';
class PageLayout extends StatelessWidget{
final String title;
final Widget body;
final Widget? footer;
const PageLayout({
super.key,
required this.title,
required this.body,
this.footer
});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
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(title,
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
),
)
)
],
),
),
SizedBox(height: SizeUtils.getByScreen(small: 30, big: 28)),
body,
?footer
],
)
),
);
}
}

View File

@@ -0,0 +1,69 @@
name: legacy_shared
description: "A new Flutter project."
version: 0.0.1
homepage:
environment:
sdk: ^3.9.2
flutter: ">=1.17.0"
dependencies:
flutter:
sdk: flutter
#modules dependencies go here
auth:
path: ../../../../modules/auth
#packages dependencies go here
design_system:
path: ../../../../packages/design_system
utils:
path: ../../../../packages/utils
#dependencies go here
get_it: ^9.0.5
flutter_riverpod: ^3.0.3
freezed_annotation: ^3.1.0
freezed: ^3.2.3
json_annotation: ^4.9.0
json_serializable: ^6.11.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^5.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# To add assets to your package, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/to/asset-from-package
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/to/resolution-aware-images
# To add custom fonts to your package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/to/font-from-package