feat: update user
This commit is contained in:
parent
bfd4604897
commit
7919825955
@ -1,9 +1,10 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../domain/auth/auth.dart';
|
||||
import '../../domain/user/user.dart';
|
||||
|
||||
part 'auth_event.dart';
|
||||
part 'auth_state.dart';
|
||||
|
||||
46
lib/application/user/user_edit_form/user_edit_form_bloc.dart
Normal file
46
lib/application/user/user_edit_form/user_edit_form_bloc.dart
Normal file
@ -0,0 +1,46 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/user/user.dart';
|
||||
|
||||
part 'user_edit_form_event.dart';
|
||||
part 'user_edit_form_state.dart';
|
||||
part 'user_edit_form_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class UserEditFormBloc extends Bloc<UserEditFormEvent, UserEditFormState> {
|
||||
final IUserRepository _repository;
|
||||
UserEditFormBloc(this._repository) : super(UserEditFormState.initial()) {
|
||||
on<UserEditFormEvent>(_onUserEditFormEvent);
|
||||
}
|
||||
|
||||
Future<void> _onUserEditFormEvent(
|
||||
UserEditFormEvent event,
|
||||
Emitter<UserEditFormState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
nameChanged: (e) async {
|
||||
emit(state.copyWith(name: e.name));
|
||||
},
|
||||
submitted: (e) async {
|
||||
Either<UserFailure, User>? failureOrUser;
|
||||
emit(state.copyWith(isSubmitting: true, failureOrUserOption: none()));
|
||||
|
||||
final nameValid = state.name.isNotEmpty;
|
||||
|
||||
if (nameValid) {
|
||||
failureOrUser = await _repository.editUser(name: state.name);
|
||||
emit(
|
||||
state.copyWith(
|
||||
isSubmitting: false,
|
||||
failureOrUserOption: optionOf(failureOrUser),
|
||||
),
|
||||
);
|
||||
}
|
||||
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,542 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// 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_edit_form_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UserEditFormEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String name) nameChanged,
|
||||
required TResult Function() submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String name)? nameChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String name)? nameChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_NameChanged value) nameChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_NameChanged value)? nameChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_NameChanged value)? nameChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $UserEditFormEventCopyWith<$Res> {
|
||||
factory $UserEditFormEventCopyWith(
|
||||
UserEditFormEvent value,
|
||||
$Res Function(UserEditFormEvent) then,
|
||||
) = _$UserEditFormEventCopyWithImpl<$Res, UserEditFormEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$UserEditFormEventCopyWithImpl<$Res, $Val extends UserEditFormEvent>
|
||||
implements $UserEditFormEventCopyWith<$Res> {
|
||||
_$UserEditFormEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of UserEditFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$NameChangedImplCopyWith<$Res> {
|
||||
factory _$$NameChangedImplCopyWith(
|
||||
_$NameChangedImpl value,
|
||||
$Res Function(_$NameChangedImpl) then,
|
||||
) = __$$NameChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String name});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$NameChangedImplCopyWithImpl<$Res>
|
||||
extends _$UserEditFormEventCopyWithImpl<$Res, _$NameChangedImpl>
|
||||
implements _$$NameChangedImplCopyWith<$Res> {
|
||||
__$$NameChangedImplCopyWithImpl(
|
||||
_$NameChangedImpl _value,
|
||||
$Res Function(_$NameChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of UserEditFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? name = null}) {
|
||||
return _then(
|
||||
_$NameChangedImpl(
|
||||
null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$NameChangedImpl implements _NameChanged {
|
||||
const _$NameChangedImpl(this.name);
|
||||
|
||||
@override
|
||||
final String name;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserEditFormEvent.nameChanged(name: $name)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$NameChangedImpl &&
|
||||
(identical(other.name, name) || other.name == name));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, name);
|
||||
|
||||
/// Create a copy of UserEditFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$NameChangedImplCopyWith<_$NameChangedImpl> get copyWith =>
|
||||
__$$NameChangedImplCopyWithImpl<_$NameChangedImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String name) nameChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return nameChanged(name);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String name)? nameChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return nameChanged?.call(name);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String name)? nameChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (nameChanged != null) {
|
||||
return nameChanged(name);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_NameChanged value) nameChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return nameChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_NameChanged value)? nameChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return nameChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_NameChanged value)? nameChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (nameChanged != null) {
|
||||
return nameChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _NameChanged implements UserEditFormEvent {
|
||||
const factory _NameChanged(final String name) = _$NameChangedImpl;
|
||||
|
||||
String get name;
|
||||
|
||||
/// Create a copy of UserEditFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$NameChangedImplCopyWith<_$NameChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||
factory _$$SubmittedImplCopyWith(
|
||||
_$SubmittedImpl value,
|
||||
$Res Function(_$SubmittedImpl) then,
|
||||
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||
extends _$UserEditFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||
implements _$$SubmittedImplCopyWith<$Res> {
|
||||
__$$SubmittedImplCopyWithImpl(
|
||||
_$SubmittedImpl _value,
|
||||
$Res Function(_$SubmittedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of UserEditFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SubmittedImpl implements _Submitted {
|
||||
const _$SubmittedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserEditFormEvent.submitted()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$SubmittedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String name) nameChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return submitted();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String name)? nameChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return submitted?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String name)? nameChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_NameChanged value) nameChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return submitted(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_NameChanged value)? nameChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return submitted?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_NameChanged value)? nameChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Submitted implements UserEditFormEvent {
|
||||
const factory _Submitted() = _$SubmittedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UserEditFormState {
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
Option<Either<UserFailure, User>> get failureOrUserOption =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||
bool get showErrorMessages => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of UserEditFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$UserEditFormStateCopyWith<UserEditFormState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $UserEditFormStateCopyWith<$Res> {
|
||||
factory $UserEditFormStateCopyWith(
|
||||
UserEditFormState value,
|
||||
$Res Function(UserEditFormState) then,
|
||||
) = _$UserEditFormStateCopyWithImpl<$Res, UserEditFormState>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String name,
|
||||
Option<Either<UserFailure, User>> failureOrUserOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$UserEditFormStateCopyWithImpl<$Res, $Val extends UserEditFormState>
|
||||
implements $UserEditFormStateCopyWith<$Res> {
|
||||
_$UserEditFormStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of UserEditFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? name = null,
|
||||
Object? failureOrUserOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
failureOrUserOption: null == failureOrUserOption
|
||||
? _value.failureOrUserOption
|
||||
: failureOrUserOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<UserFailure, User>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$UserEditFormStateImplCopyWith<$Res>
|
||||
implements $UserEditFormStateCopyWith<$Res> {
|
||||
factory _$$UserEditFormStateImplCopyWith(
|
||||
_$UserEditFormStateImpl value,
|
||||
$Res Function(_$UserEditFormStateImpl) then,
|
||||
) = __$$UserEditFormStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String name,
|
||||
Option<Either<UserFailure, User>> failureOrUserOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$UserEditFormStateImplCopyWithImpl<$Res>
|
||||
extends _$UserEditFormStateCopyWithImpl<$Res, _$UserEditFormStateImpl>
|
||||
implements _$$UserEditFormStateImplCopyWith<$Res> {
|
||||
__$$UserEditFormStateImplCopyWithImpl(
|
||||
_$UserEditFormStateImpl _value,
|
||||
$Res Function(_$UserEditFormStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of UserEditFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? name = null,
|
||||
Object? failureOrUserOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$UserEditFormStateImpl(
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
failureOrUserOption: null == failureOrUserOption
|
||||
? _value.failureOrUserOption
|
||||
: failureOrUserOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<UserFailure, User>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$UserEditFormStateImpl implements _UserEditFormState {
|
||||
const _$UserEditFormStateImpl({
|
||||
required this.name,
|
||||
required this.failureOrUserOption,
|
||||
this.isSubmitting = false,
|
||||
this.showErrorMessages = false,
|
||||
});
|
||||
|
||||
@override
|
||||
final String name;
|
||||
@override
|
||||
final Option<Either<UserFailure, User>> failureOrUserOption;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isSubmitting;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool showErrorMessages;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserEditFormState(name: $name, failureOrUserOption: $failureOrUserOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$UserEditFormStateImpl &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.failureOrUserOption, failureOrUserOption) ||
|
||||
other.failureOrUserOption == failureOrUserOption) &&
|
||||
(identical(other.isSubmitting, isSubmitting) ||
|
||||
other.isSubmitting == isSubmitting) &&
|
||||
(identical(other.showErrorMessages, showErrorMessages) ||
|
||||
other.showErrorMessages == showErrorMessages));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
name,
|
||||
failureOrUserOption,
|
||||
isSubmitting,
|
||||
showErrorMessages,
|
||||
);
|
||||
|
||||
/// Create a copy of UserEditFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$UserEditFormStateImplCopyWith<_$UserEditFormStateImpl> get copyWith =>
|
||||
__$$UserEditFormStateImplCopyWithImpl<_$UserEditFormStateImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
}
|
||||
|
||||
abstract class _UserEditFormState implements UserEditFormState {
|
||||
const factory _UserEditFormState({
|
||||
required final String name,
|
||||
required final Option<Either<UserFailure, User>> failureOrUserOption,
|
||||
final bool isSubmitting,
|
||||
final bool showErrorMessages,
|
||||
}) = _$UserEditFormStateImpl;
|
||||
|
||||
@override
|
||||
String get name;
|
||||
@override
|
||||
Option<Either<UserFailure, User>> get failureOrUserOption;
|
||||
@override
|
||||
bool get isSubmitting;
|
||||
@override
|
||||
bool get showErrorMessages;
|
||||
|
||||
/// Create a copy of UserEditFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$UserEditFormStateImplCopyWith<_$UserEditFormStateImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
part of 'user_edit_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class UserEditFormEvent with _$UserEditFormEvent {
|
||||
const factory UserEditFormEvent.nameChanged(String name) = _NameChanged;
|
||||
const factory UserEditFormEvent.submitted() = _Submitted;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
part of 'user_edit_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class UserEditFormState with _$UserEditFormState {
|
||||
const factory UserEditFormState({
|
||||
required String name,
|
||||
required Option<Either<UserFailure, User>> failureOrUserOption,
|
||||
@Default(false) bool isSubmitting,
|
||||
@Default(false) bool showErrorMessages,
|
||||
}) = _UserEditFormState;
|
||||
|
||||
factory UserEditFormState.initial() =>
|
||||
UserEditFormState(name: '', failureOrUserOption: none());
|
||||
}
|
||||
@ -30,4 +30,7 @@ class ApiPath {
|
||||
|
||||
// Outlet
|
||||
static const String outlet = '/api/v1/outlets';
|
||||
|
||||
// User
|
||||
static const String user = '/api/v1/users';
|
||||
}
|
||||
|
||||
@ -2,10 +2,10 @@ import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
|
||||
import '../../common/api/api_failure.dart';
|
||||
import '../user/user.dart';
|
||||
|
||||
part 'failures/auth_failure.dart';
|
||||
part 'repositories/i_auth_repository.dart';
|
||||
part 'entities/auth_entity.dart';
|
||||
part 'entities/user_entity.dart';
|
||||
|
||||
part 'auth.freezed.dart';
|
||||
|
||||
@ -691,349 +691,3 @@ abstract class _Auth extends Auth {
|
||||
_$$AuthImplCopyWith<_$AuthImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$User {
|
||||
String get id => throw _privateConstructorUsedError;
|
||||
String get organizationId => throw _privateConstructorUsedError;
|
||||
String get outletId => throw _privateConstructorUsedError;
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
String get email => throw _privateConstructorUsedError;
|
||||
String get role => throw _privateConstructorUsedError;
|
||||
Map<String, dynamic> get permissions => throw _privateConstructorUsedError;
|
||||
bool get isActive => throw _privateConstructorUsedError;
|
||||
DateTime get createdAt => throw _privateConstructorUsedError;
|
||||
DateTime get updatedAt => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$UserCopyWith<User> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $UserCopyWith<$Res> {
|
||||
factory $UserCopyWith(User value, $Res Function(User) then) =
|
||||
_$UserCopyWithImpl<$Res, User>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id,
|
||||
String organizationId,
|
||||
String outletId,
|
||||
String name,
|
||||
String email,
|
||||
String role,
|
||||
Map<String, dynamic> permissions,
|
||||
bool isActive,
|
||||
DateTime createdAt,
|
||||
DateTime updatedAt,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$UserCopyWithImpl<$Res, $Val extends User>
|
||||
implements $UserCopyWith<$Res> {
|
||||
_$UserCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? organizationId = null,
|
||||
Object? outletId = null,
|
||||
Object? name = null,
|
||||
Object? email = null,
|
||||
Object? role = null,
|
||||
Object? permissions = null,
|
||||
Object? isActive = null,
|
||||
Object? createdAt = null,
|
||||
Object? updatedAt = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
organizationId: null == organizationId
|
||||
? _value.organizationId
|
||||
: organizationId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
outletId: null == outletId
|
||||
? _value.outletId
|
||||
: outletId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
email: null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
role: null == role
|
||||
? _value.role
|
||||
: role // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
permissions: null == permissions
|
||||
? _value.permissions
|
||||
: permissions // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>,
|
||||
isActive: null == isActive
|
||||
? _value.isActive
|
||||
: isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
updatedAt: null == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$UserImplCopyWith<$Res> implements $UserCopyWith<$Res> {
|
||||
factory _$$UserImplCopyWith(
|
||||
_$UserImpl value,
|
||||
$Res Function(_$UserImpl) then,
|
||||
) = __$$UserImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String id,
|
||||
String organizationId,
|
||||
String outletId,
|
||||
String name,
|
||||
String email,
|
||||
String role,
|
||||
Map<String, dynamic> permissions,
|
||||
bool isActive,
|
||||
DateTime createdAt,
|
||||
DateTime updatedAt,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$UserImplCopyWithImpl<$Res>
|
||||
extends _$UserCopyWithImpl<$Res, _$UserImpl>
|
||||
implements _$$UserImplCopyWith<$Res> {
|
||||
__$$UserImplCopyWithImpl(_$UserImpl _value, $Res Function(_$UserImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? organizationId = null,
|
||||
Object? outletId = null,
|
||||
Object? name = null,
|
||||
Object? email = null,
|
||||
Object? role = null,
|
||||
Object? permissions = null,
|
||||
Object? isActive = null,
|
||||
Object? createdAt = null,
|
||||
Object? updatedAt = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$UserImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
organizationId: null == organizationId
|
||||
? _value.organizationId
|
||||
: organizationId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
outletId: null == outletId
|
||||
? _value.outletId
|
||||
: outletId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
email: null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
role: null == role
|
||||
? _value.role
|
||||
: role // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
permissions: null == permissions
|
||||
? _value._permissions
|
||||
: permissions // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>,
|
||||
isActive: null == isActive
|
||||
? _value.isActive
|
||||
: isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
updatedAt: null == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$UserImpl extends _User {
|
||||
const _$UserImpl({
|
||||
required this.id,
|
||||
required this.organizationId,
|
||||
required this.outletId,
|
||||
required this.name,
|
||||
required this.email,
|
||||
required this.role,
|
||||
required final Map<String, dynamic> permissions,
|
||||
required this.isActive,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
}) : _permissions = permissions,
|
||||
super._();
|
||||
|
||||
@override
|
||||
final String id;
|
||||
@override
|
||||
final String organizationId;
|
||||
@override
|
||||
final String outletId;
|
||||
@override
|
||||
final String name;
|
||||
@override
|
||||
final String email;
|
||||
@override
|
||||
final String role;
|
||||
final Map<String, dynamic> _permissions;
|
||||
@override
|
||||
Map<String, dynamic> get permissions {
|
||||
if (_permissions is EqualUnmodifiableMapView) return _permissions;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_permissions);
|
||||
}
|
||||
|
||||
@override
|
||||
final bool isActive;
|
||||
@override
|
||||
final DateTime createdAt;
|
||||
@override
|
||||
final DateTime updatedAt;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'User(id: $id, organizationId: $organizationId, outletId: $outletId, name: $name, email: $email, role: $role, permissions: $permissions, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$UserImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.organizationId, organizationId) ||
|
||||
other.organizationId == organizationId) &&
|
||||
(identical(other.outletId, outletId) ||
|
||||
other.outletId == outletId) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.email, email) || other.email == email) &&
|
||||
(identical(other.role, role) || other.role == role) &&
|
||||
const DeepCollectionEquality().equals(
|
||||
other._permissions,
|
||||
_permissions,
|
||||
) &&
|
||||
(identical(other.isActive, isActive) ||
|
||||
other.isActive == isActive) &&
|
||||
(identical(other.createdAt, createdAt) ||
|
||||
other.createdAt == createdAt) &&
|
||||
(identical(other.updatedAt, updatedAt) ||
|
||||
other.updatedAt == updatedAt));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
organizationId,
|
||||
outletId,
|
||||
name,
|
||||
email,
|
||||
role,
|
||||
const DeepCollectionEquality().hash(_permissions),
|
||||
isActive,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
);
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$UserImplCopyWith<_$UserImpl> get copyWith =>
|
||||
__$$UserImplCopyWithImpl<_$UserImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _User extends User {
|
||||
const factory _User({
|
||||
required final String id,
|
||||
required final String organizationId,
|
||||
required final String outletId,
|
||||
required final String name,
|
||||
required final String email,
|
||||
required final String role,
|
||||
required final Map<String, dynamic> permissions,
|
||||
required final bool isActive,
|
||||
required final DateTime createdAt,
|
||||
required final DateTime updatedAt,
|
||||
}) = _$UserImpl;
|
||||
const _User._() : super._();
|
||||
|
||||
@override
|
||||
String get id;
|
||||
@override
|
||||
String get organizationId;
|
||||
@override
|
||||
String get outletId;
|
||||
@override
|
||||
String get name;
|
||||
@override
|
||||
String get email;
|
||||
@override
|
||||
String get role;
|
||||
@override
|
||||
Map<String, dynamic> get permissions;
|
||||
@override
|
||||
bool get isActive;
|
||||
@override
|
||||
DateTime get createdAt;
|
||||
@override
|
||||
DateTime get updatedAt;
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$UserImplCopyWith<_$UserImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
part of '../auth.dart';
|
||||
part of '../user.dart';
|
||||
|
||||
@freezed
|
||||
class User with _$User {
|
||||
10
lib/domain/user/failures/user_failure.dart
Normal file
10
lib/domain/user/failures/user_failure.dart
Normal file
@ -0,0 +1,10 @@
|
||||
part of '../user.dart';
|
||||
|
||||
@freezed
|
||||
sealed class UserFailure with _$UserFailure {
|
||||
const factory UserFailure.serverError(ApiFailure failure) = _ServerError;
|
||||
const factory UserFailure.unexpectedError() = _UnexpectedError;
|
||||
const factory UserFailure.empty() = _Empty;
|
||||
const factory UserFailure.dynamicErrorMessage(String erroMessage) =
|
||||
_DynamicErrorMessage;
|
||||
}
|
||||
5
lib/domain/user/repositories/i_user_repository.dart
Normal file
5
lib/domain/user/repositories/i_user_repository.dart
Normal file
@ -0,0 +1,5 @@
|
||||
part of '../user.dart';
|
||||
|
||||
abstract class IUserRepository {
|
||||
Future<Either<UserFailure, User>> editUser({required String name});
|
||||
}
|
||||
10
lib/domain/user/user.dart
Normal file
10
lib/domain/user/user.dart
Normal file
@ -0,0 +1,10 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../../common/api/api_failure.dart';
|
||||
|
||||
part 'user.freezed.dart';
|
||||
|
||||
part 'entities/user_entity.dart';
|
||||
part 'failures/user_failure.dart';
|
||||
part 'repositories/i_user_repository.dart';
|
||||
995
lib/domain/user/user.freezed.dart
Normal file
995
lib/domain/user/user.freezed.dart
Normal file
@ -0,0 +1,995 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// 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.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$User {
|
||||
String get id => throw _privateConstructorUsedError;
|
||||
String get organizationId => throw _privateConstructorUsedError;
|
||||
String get outletId => throw _privateConstructorUsedError;
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
String get email => throw _privateConstructorUsedError;
|
||||
String get role => throw _privateConstructorUsedError;
|
||||
Map<String, dynamic> get permissions => throw _privateConstructorUsedError;
|
||||
bool get isActive => throw _privateConstructorUsedError;
|
||||
DateTime get createdAt => throw _privateConstructorUsedError;
|
||||
DateTime get updatedAt => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$UserCopyWith<User> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $UserCopyWith<$Res> {
|
||||
factory $UserCopyWith(User value, $Res Function(User) then) =
|
||||
_$UserCopyWithImpl<$Res, User>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id,
|
||||
String organizationId,
|
||||
String outletId,
|
||||
String name,
|
||||
String email,
|
||||
String role,
|
||||
Map<String, dynamic> permissions,
|
||||
bool isActive,
|
||||
DateTime createdAt,
|
||||
DateTime updatedAt,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$UserCopyWithImpl<$Res, $Val extends User>
|
||||
implements $UserCopyWith<$Res> {
|
||||
_$UserCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? organizationId = null,
|
||||
Object? outletId = null,
|
||||
Object? name = null,
|
||||
Object? email = null,
|
||||
Object? role = null,
|
||||
Object? permissions = null,
|
||||
Object? isActive = null,
|
||||
Object? createdAt = null,
|
||||
Object? updatedAt = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
organizationId: null == organizationId
|
||||
? _value.organizationId
|
||||
: organizationId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
outletId: null == outletId
|
||||
? _value.outletId
|
||||
: outletId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
email: null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
role: null == role
|
||||
? _value.role
|
||||
: role // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
permissions: null == permissions
|
||||
? _value.permissions
|
||||
: permissions // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>,
|
||||
isActive: null == isActive
|
||||
? _value.isActive
|
||||
: isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
updatedAt: null == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$UserImplCopyWith<$Res> implements $UserCopyWith<$Res> {
|
||||
factory _$$UserImplCopyWith(
|
||||
_$UserImpl value,
|
||||
$Res Function(_$UserImpl) then,
|
||||
) = __$$UserImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String id,
|
||||
String organizationId,
|
||||
String outletId,
|
||||
String name,
|
||||
String email,
|
||||
String role,
|
||||
Map<String, dynamic> permissions,
|
||||
bool isActive,
|
||||
DateTime createdAt,
|
||||
DateTime updatedAt,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$UserImplCopyWithImpl<$Res>
|
||||
extends _$UserCopyWithImpl<$Res, _$UserImpl>
|
||||
implements _$$UserImplCopyWith<$Res> {
|
||||
__$$UserImplCopyWithImpl(_$UserImpl _value, $Res Function(_$UserImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? organizationId = null,
|
||||
Object? outletId = null,
|
||||
Object? name = null,
|
||||
Object? email = null,
|
||||
Object? role = null,
|
||||
Object? permissions = null,
|
||||
Object? isActive = null,
|
||||
Object? createdAt = null,
|
||||
Object? updatedAt = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$UserImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
organizationId: null == organizationId
|
||||
? _value.organizationId
|
||||
: organizationId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
outletId: null == outletId
|
||||
? _value.outletId
|
||||
: outletId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
email: null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
role: null == role
|
||||
? _value.role
|
||||
: role // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
permissions: null == permissions
|
||||
? _value._permissions
|
||||
: permissions // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>,
|
||||
isActive: null == isActive
|
||||
? _value.isActive
|
||||
: isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
updatedAt: null == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$UserImpl extends _User {
|
||||
const _$UserImpl({
|
||||
required this.id,
|
||||
required this.organizationId,
|
||||
required this.outletId,
|
||||
required this.name,
|
||||
required this.email,
|
||||
required this.role,
|
||||
required final Map<String, dynamic> permissions,
|
||||
required this.isActive,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
}) : _permissions = permissions,
|
||||
super._();
|
||||
|
||||
@override
|
||||
final String id;
|
||||
@override
|
||||
final String organizationId;
|
||||
@override
|
||||
final String outletId;
|
||||
@override
|
||||
final String name;
|
||||
@override
|
||||
final String email;
|
||||
@override
|
||||
final String role;
|
||||
final Map<String, dynamic> _permissions;
|
||||
@override
|
||||
Map<String, dynamic> get permissions {
|
||||
if (_permissions is EqualUnmodifiableMapView) return _permissions;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_permissions);
|
||||
}
|
||||
|
||||
@override
|
||||
final bool isActive;
|
||||
@override
|
||||
final DateTime createdAt;
|
||||
@override
|
||||
final DateTime updatedAt;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'User(id: $id, organizationId: $organizationId, outletId: $outletId, name: $name, email: $email, role: $role, permissions: $permissions, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$UserImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.organizationId, organizationId) ||
|
||||
other.organizationId == organizationId) &&
|
||||
(identical(other.outletId, outletId) ||
|
||||
other.outletId == outletId) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.email, email) || other.email == email) &&
|
||||
(identical(other.role, role) || other.role == role) &&
|
||||
const DeepCollectionEquality().equals(
|
||||
other._permissions,
|
||||
_permissions,
|
||||
) &&
|
||||
(identical(other.isActive, isActive) ||
|
||||
other.isActive == isActive) &&
|
||||
(identical(other.createdAt, createdAt) ||
|
||||
other.createdAt == createdAt) &&
|
||||
(identical(other.updatedAt, updatedAt) ||
|
||||
other.updatedAt == updatedAt));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
organizationId,
|
||||
outletId,
|
||||
name,
|
||||
email,
|
||||
role,
|
||||
const DeepCollectionEquality().hash(_permissions),
|
||||
isActive,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
);
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$UserImplCopyWith<_$UserImpl> get copyWith =>
|
||||
__$$UserImplCopyWithImpl<_$UserImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _User extends User {
|
||||
const factory _User({
|
||||
required final String id,
|
||||
required final String organizationId,
|
||||
required final String outletId,
|
||||
required final String name,
|
||||
required final String email,
|
||||
required final String role,
|
||||
required final Map<String, dynamic> permissions,
|
||||
required final bool isActive,
|
||||
required final DateTime createdAt,
|
||||
required final DateTime updatedAt,
|
||||
}) = _$UserImpl;
|
||||
const _User._() : super._();
|
||||
|
||||
@override
|
||||
String get id;
|
||||
@override
|
||||
String get organizationId;
|
||||
@override
|
||||
String get outletId;
|
||||
@override
|
||||
String get name;
|
||||
@override
|
||||
String get email;
|
||||
@override
|
||||
String get role;
|
||||
@override
|
||||
Map<String, dynamic> get permissions;
|
||||
@override
|
||||
bool get isActive;
|
||||
@override
|
||||
DateTime get createdAt;
|
||||
@override
|
||||
DateTime get updatedAt;
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$UserImplCopyWith<_$UserImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UserFailure {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(ApiFailure failure) serverError,
|
||||
required TResult Function() unexpectedError,
|
||||
required TResult Function() empty,
|
||||
required TResult Function(String erroMessage) dynamicErrorMessage,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(ApiFailure failure)? serverError,
|
||||
TResult? Function()? unexpectedError,
|
||||
TResult? Function()? empty,
|
||||
TResult? Function(String erroMessage)? dynamicErrorMessage,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(ApiFailure failure)? serverError,
|
||||
TResult Function()? unexpectedError,
|
||||
TResult Function()? empty,
|
||||
TResult Function(String erroMessage)? dynamicErrorMessage,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_ServerError value) serverError,
|
||||
required TResult Function(_UnexpectedError value) unexpectedError,
|
||||
required TResult Function(_Empty value) empty,
|
||||
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_ServerError value)? serverError,
|
||||
TResult? Function(_UnexpectedError value)? unexpectedError,
|
||||
TResult? Function(_Empty value)? empty,
|
||||
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_ServerError value)? serverError,
|
||||
TResult Function(_UnexpectedError value)? unexpectedError,
|
||||
TResult Function(_Empty value)? empty,
|
||||
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $UserFailureCopyWith<$Res> {
|
||||
factory $UserFailureCopyWith(
|
||||
UserFailure value,
|
||||
$Res Function(UserFailure) then,
|
||||
) = _$UserFailureCopyWithImpl<$Res, UserFailure>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$UserFailureCopyWithImpl<$Res, $Val extends UserFailure>
|
||||
implements $UserFailureCopyWith<$Res> {
|
||||
_$UserFailureCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of UserFailure
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ServerErrorImplCopyWith<$Res> {
|
||||
factory _$$ServerErrorImplCopyWith(
|
||||
_$ServerErrorImpl value,
|
||||
$Res Function(_$ServerErrorImpl) then,
|
||||
) = __$$ServerErrorImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({ApiFailure failure});
|
||||
|
||||
$ApiFailureCopyWith<$Res> get failure;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ServerErrorImplCopyWithImpl<$Res>
|
||||
extends _$UserFailureCopyWithImpl<$Res, _$ServerErrorImpl>
|
||||
implements _$$ServerErrorImplCopyWith<$Res> {
|
||||
__$$ServerErrorImplCopyWithImpl(
|
||||
_$ServerErrorImpl _value,
|
||||
$Res Function(_$ServerErrorImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of UserFailure
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? failure = null}) {
|
||||
return _then(
|
||||
_$ServerErrorImpl(
|
||||
null == failure
|
||||
? _value.failure
|
||||
: failure // ignore: cast_nullable_to_non_nullable
|
||||
as ApiFailure,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of UserFailure
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ApiFailureCopyWith<$Res> get failure {
|
||||
return $ApiFailureCopyWith<$Res>(_value.failure, (value) {
|
||||
return _then(_value.copyWith(failure: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ServerErrorImpl implements _ServerError {
|
||||
const _$ServerErrorImpl(this.failure);
|
||||
|
||||
@override
|
||||
final ApiFailure failure;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserFailure.serverError(failure: $failure)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ServerErrorImpl &&
|
||||
(identical(other.failure, failure) || other.failure == failure));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, failure);
|
||||
|
||||
/// Create a copy of UserFailure
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ServerErrorImplCopyWith<_$ServerErrorImpl> get copyWith =>
|
||||
__$$ServerErrorImplCopyWithImpl<_$ServerErrorImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(ApiFailure failure) serverError,
|
||||
required TResult Function() unexpectedError,
|
||||
required TResult Function() empty,
|
||||
required TResult Function(String erroMessage) dynamicErrorMessage,
|
||||
}) {
|
||||
return serverError(failure);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(ApiFailure failure)? serverError,
|
||||
TResult? Function()? unexpectedError,
|
||||
TResult? Function()? empty,
|
||||
TResult? Function(String erroMessage)? dynamicErrorMessage,
|
||||
}) {
|
||||
return serverError?.call(failure);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(ApiFailure failure)? serverError,
|
||||
TResult Function()? unexpectedError,
|
||||
TResult Function()? empty,
|
||||
TResult Function(String erroMessage)? dynamicErrorMessage,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (serverError != null) {
|
||||
return serverError(failure);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_ServerError value) serverError,
|
||||
required TResult Function(_UnexpectedError value) unexpectedError,
|
||||
required TResult Function(_Empty value) empty,
|
||||
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
|
||||
}) {
|
||||
return serverError(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_ServerError value)? serverError,
|
||||
TResult? Function(_UnexpectedError value)? unexpectedError,
|
||||
TResult? Function(_Empty value)? empty,
|
||||
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||
}) {
|
||||
return serverError?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_ServerError value)? serverError,
|
||||
TResult Function(_UnexpectedError value)? unexpectedError,
|
||||
TResult Function(_Empty value)? empty,
|
||||
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (serverError != null) {
|
||||
return serverError(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _ServerError implements UserFailure {
|
||||
const factory _ServerError(final ApiFailure failure) = _$ServerErrorImpl;
|
||||
|
||||
ApiFailure get failure;
|
||||
|
||||
/// Create a copy of UserFailure
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ServerErrorImplCopyWith<_$ServerErrorImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$UnexpectedErrorImplCopyWith<$Res> {
|
||||
factory _$$UnexpectedErrorImplCopyWith(
|
||||
_$UnexpectedErrorImpl value,
|
||||
$Res Function(_$UnexpectedErrorImpl) then,
|
||||
) = __$$UnexpectedErrorImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$UnexpectedErrorImplCopyWithImpl<$Res>
|
||||
extends _$UserFailureCopyWithImpl<$Res, _$UnexpectedErrorImpl>
|
||||
implements _$$UnexpectedErrorImplCopyWith<$Res> {
|
||||
__$$UnexpectedErrorImplCopyWithImpl(
|
||||
_$UnexpectedErrorImpl _value,
|
||||
$Res Function(_$UnexpectedErrorImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of UserFailure
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$UnexpectedErrorImpl implements _UnexpectedError {
|
||||
const _$UnexpectedErrorImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserFailure.unexpectedError()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$UnexpectedErrorImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(ApiFailure failure) serverError,
|
||||
required TResult Function() unexpectedError,
|
||||
required TResult Function() empty,
|
||||
required TResult Function(String erroMessage) dynamicErrorMessage,
|
||||
}) {
|
||||
return unexpectedError();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(ApiFailure failure)? serverError,
|
||||
TResult? Function()? unexpectedError,
|
||||
TResult? Function()? empty,
|
||||
TResult? Function(String erroMessage)? dynamicErrorMessage,
|
||||
}) {
|
||||
return unexpectedError?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(ApiFailure failure)? serverError,
|
||||
TResult Function()? unexpectedError,
|
||||
TResult Function()? empty,
|
||||
TResult Function(String erroMessage)? dynamicErrorMessage,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (unexpectedError != null) {
|
||||
return unexpectedError();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_ServerError value) serverError,
|
||||
required TResult Function(_UnexpectedError value) unexpectedError,
|
||||
required TResult Function(_Empty value) empty,
|
||||
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
|
||||
}) {
|
||||
return unexpectedError(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_ServerError value)? serverError,
|
||||
TResult? Function(_UnexpectedError value)? unexpectedError,
|
||||
TResult? Function(_Empty value)? empty,
|
||||
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||
}) {
|
||||
return unexpectedError?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_ServerError value)? serverError,
|
||||
TResult Function(_UnexpectedError value)? unexpectedError,
|
||||
TResult Function(_Empty value)? empty,
|
||||
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (unexpectedError != null) {
|
||||
return unexpectedError(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _UnexpectedError implements UserFailure {
|
||||
const factory _UnexpectedError() = _$UnexpectedErrorImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$EmptyImplCopyWith<$Res> {
|
||||
factory _$$EmptyImplCopyWith(
|
||||
_$EmptyImpl value,
|
||||
$Res Function(_$EmptyImpl) then,
|
||||
) = __$$EmptyImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$EmptyImplCopyWithImpl<$Res>
|
||||
extends _$UserFailureCopyWithImpl<$Res, _$EmptyImpl>
|
||||
implements _$$EmptyImplCopyWith<$Res> {
|
||||
__$$EmptyImplCopyWithImpl(
|
||||
_$EmptyImpl _value,
|
||||
$Res Function(_$EmptyImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of UserFailure
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$EmptyImpl implements _Empty {
|
||||
const _$EmptyImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserFailure.empty()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$EmptyImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(ApiFailure failure) serverError,
|
||||
required TResult Function() unexpectedError,
|
||||
required TResult Function() empty,
|
||||
required TResult Function(String erroMessage) dynamicErrorMessage,
|
||||
}) {
|
||||
return empty();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(ApiFailure failure)? serverError,
|
||||
TResult? Function()? unexpectedError,
|
||||
TResult? Function()? empty,
|
||||
TResult? Function(String erroMessage)? dynamicErrorMessage,
|
||||
}) {
|
||||
return empty?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(ApiFailure failure)? serverError,
|
||||
TResult Function()? unexpectedError,
|
||||
TResult Function()? empty,
|
||||
TResult Function(String erroMessage)? dynamicErrorMessage,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (empty != null) {
|
||||
return empty();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_ServerError value) serverError,
|
||||
required TResult Function(_UnexpectedError value) unexpectedError,
|
||||
required TResult Function(_Empty value) empty,
|
||||
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
|
||||
}) {
|
||||
return empty(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_ServerError value)? serverError,
|
||||
TResult? Function(_UnexpectedError value)? unexpectedError,
|
||||
TResult? Function(_Empty value)? empty,
|
||||
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||
}) {
|
||||
return empty?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_ServerError value)? serverError,
|
||||
TResult Function(_UnexpectedError value)? unexpectedError,
|
||||
TResult Function(_Empty value)? empty,
|
||||
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (empty != null) {
|
||||
return empty(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Empty implements UserFailure {
|
||||
const factory _Empty() = _$EmptyImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$DynamicErrorMessageImplCopyWith<$Res> {
|
||||
factory _$$DynamicErrorMessageImplCopyWith(
|
||||
_$DynamicErrorMessageImpl value,
|
||||
$Res Function(_$DynamicErrorMessageImpl) then,
|
||||
) = __$$DynamicErrorMessageImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String erroMessage});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$DynamicErrorMessageImplCopyWithImpl<$Res>
|
||||
extends _$UserFailureCopyWithImpl<$Res, _$DynamicErrorMessageImpl>
|
||||
implements _$$DynamicErrorMessageImplCopyWith<$Res> {
|
||||
__$$DynamicErrorMessageImplCopyWithImpl(
|
||||
_$DynamicErrorMessageImpl _value,
|
||||
$Res Function(_$DynamicErrorMessageImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of UserFailure
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? erroMessage = null}) {
|
||||
return _then(
|
||||
_$DynamicErrorMessageImpl(
|
||||
null == erroMessage
|
||||
? _value.erroMessage
|
||||
: erroMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$DynamicErrorMessageImpl implements _DynamicErrorMessage {
|
||||
const _$DynamicErrorMessageImpl(this.erroMessage);
|
||||
|
||||
@override
|
||||
final String erroMessage;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserFailure.dynamicErrorMessage(erroMessage: $erroMessage)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$DynamicErrorMessageImpl &&
|
||||
(identical(other.erroMessage, erroMessage) ||
|
||||
other.erroMessage == erroMessage));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, erroMessage);
|
||||
|
||||
/// Create a copy of UserFailure
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$DynamicErrorMessageImplCopyWith<_$DynamicErrorMessageImpl> get copyWith =>
|
||||
__$$DynamicErrorMessageImplCopyWithImpl<_$DynamicErrorMessageImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(ApiFailure failure) serverError,
|
||||
required TResult Function() unexpectedError,
|
||||
required TResult Function() empty,
|
||||
required TResult Function(String erroMessage) dynamicErrorMessage,
|
||||
}) {
|
||||
return dynamicErrorMessage(erroMessage);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(ApiFailure failure)? serverError,
|
||||
TResult? Function()? unexpectedError,
|
||||
TResult? Function()? empty,
|
||||
TResult? Function(String erroMessage)? dynamicErrorMessage,
|
||||
}) {
|
||||
return dynamicErrorMessage?.call(erroMessage);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(ApiFailure failure)? serverError,
|
||||
TResult Function()? unexpectedError,
|
||||
TResult Function()? empty,
|
||||
TResult Function(String erroMessage)? dynamicErrorMessage,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (dynamicErrorMessage != null) {
|
||||
return dynamicErrorMessage(erroMessage);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_ServerError value) serverError,
|
||||
required TResult Function(_UnexpectedError value) unexpectedError,
|
||||
required TResult Function(_Empty value) empty,
|
||||
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
|
||||
}) {
|
||||
return dynamicErrorMessage(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_ServerError value)? serverError,
|
||||
TResult? Function(_UnexpectedError value)? unexpectedError,
|
||||
TResult? Function(_Empty value)? empty,
|
||||
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||
}) {
|
||||
return dynamicErrorMessage?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_ServerError value)? serverError,
|
||||
TResult Function(_UnexpectedError value)? unexpectedError,
|
||||
TResult Function(_Empty value)? empty,
|
||||
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (dynamicErrorMessage != null) {
|
||||
return dynamicErrorMessage(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _DynamicErrorMessage implements UserFailure {
|
||||
const factory _DynamicErrorMessage(final String erroMessage) =
|
||||
_$DynamicErrorMessageImpl;
|
||||
|
||||
String get erroMessage;
|
||||
|
||||
/// Create a copy of UserFailure
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$DynamicErrorMessageImplCopyWith<_$DynamicErrorMessageImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@ -5,7 +5,7 @@ import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/analytic/analytic.dart';
|
||||
import '../../../domain/analytic/repositories/i_analytic_repository.dart';
|
||||
import '../../../domain/auth/auth.dart';
|
||||
import '../../../domain/user/user.dart';
|
||||
import '../../auth/datasources/local_data_provider.dart';
|
||||
import '../datasource/remote_data_provider.dart';
|
||||
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../../domain/auth/auth.dart';
|
||||
import '../../domain/user/user.dart';
|
||||
import '../user/user_dtos.dart';
|
||||
|
||||
part 'auth_dtos.freezed.dart';
|
||||
part 'auth_dtos.g.dart';
|
||||
|
||||
part 'dto/auth_dto.dart';
|
||||
part 'dto/user_dto.dart';
|
||||
|
||||
@ -242,401 +242,3 @@ abstract class _AuthDto extends AuthDto {
|
||||
_$$AuthDtoImplCopyWith<_$AuthDtoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
UserDto _$UserDtoFromJson(Map<String, dynamic> json) {
|
||||
return _UserDto.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UserDto {
|
||||
@JsonKey(name: 'id')
|
||||
String? get id => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'organization_id')
|
||||
String? get organizationId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'outlet_id')
|
||||
String? get outletId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'name')
|
||||
String? get name => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'email')
|
||||
String? get email => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'role')
|
||||
String? get role => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'permissions')
|
||||
Map<String, dynamic>? get permissions => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'is_active')
|
||||
bool? get isActive => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'created_at')
|
||||
String? get createdAt => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'updated_at')
|
||||
String? get updatedAt => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this UserDto to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$UserDtoCopyWith<UserDto> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $UserDtoCopyWith<$Res> {
|
||||
factory $UserDtoCopyWith(UserDto value, $Res Function(UserDto) then) =
|
||||
_$UserDtoCopyWithImpl<$Res, UserDto>;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'id') String? id,
|
||||
@JsonKey(name: 'organization_id') String? organizationId,
|
||||
@JsonKey(name: 'outlet_id') String? outletId,
|
||||
@JsonKey(name: 'name') String? name,
|
||||
@JsonKey(name: 'email') String? email,
|
||||
@JsonKey(name: 'role') String? role,
|
||||
@JsonKey(name: 'permissions') Map<String, dynamic>? permissions,
|
||||
@JsonKey(name: 'is_active') bool? isActive,
|
||||
@JsonKey(name: 'created_at') String? createdAt,
|
||||
@JsonKey(name: 'updated_at') String? updatedAt,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$UserDtoCopyWithImpl<$Res, $Val extends UserDto>
|
||||
implements $UserDtoCopyWith<$Res> {
|
||||
_$UserDtoCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = freezed,
|
||||
Object? organizationId = freezed,
|
||||
Object? outletId = freezed,
|
||||
Object? name = freezed,
|
||||
Object? email = freezed,
|
||||
Object? role = freezed,
|
||||
Object? permissions = freezed,
|
||||
Object? isActive = freezed,
|
||||
Object? createdAt = freezed,
|
||||
Object? updatedAt = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
organizationId: freezed == organizationId
|
||||
? _value.organizationId
|
||||
: organizationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
outletId: freezed == outletId
|
||||
? _value.outletId
|
||||
: outletId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
name: freezed == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
email: freezed == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
role: freezed == role
|
||||
? _value.role
|
||||
: role // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
permissions: freezed == permissions
|
||||
? _value.permissions
|
||||
: permissions // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>?,
|
||||
isActive: freezed == isActive
|
||||
? _value.isActive
|
||||
: isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
createdAt: freezed == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
updatedAt: freezed == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$UserDtoImplCopyWith<$Res> implements $UserDtoCopyWith<$Res> {
|
||||
factory _$$UserDtoImplCopyWith(
|
||||
_$UserDtoImpl value,
|
||||
$Res Function(_$UserDtoImpl) then,
|
||||
) = __$$UserDtoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'id') String? id,
|
||||
@JsonKey(name: 'organization_id') String? organizationId,
|
||||
@JsonKey(name: 'outlet_id') String? outletId,
|
||||
@JsonKey(name: 'name') String? name,
|
||||
@JsonKey(name: 'email') String? email,
|
||||
@JsonKey(name: 'role') String? role,
|
||||
@JsonKey(name: 'permissions') Map<String, dynamic>? permissions,
|
||||
@JsonKey(name: 'is_active') bool? isActive,
|
||||
@JsonKey(name: 'created_at') String? createdAt,
|
||||
@JsonKey(name: 'updated_at') String? updatedAt,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$UserDtoImplCopyWithImpl<$Res>
|
||||
extends _$UserDtoCopyWithImpl<$Res, _$UserDtoImpl>
|
||||
implements _$$UserDtoImplCopyWith<$Res> {
|
||||
__$$UserDtoImplCopyWithImpl(
|
||||
_$UserDtoImpl _value,
|
||||
$Res Function(_$UserDtoImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = freezed,
|
||||
Object? organizationId = freezed,
|
||||
Object? outletId = freezed,
|
||||
Object? name = freezed,
|
||||
Object? email = freezed,
|
||||
Object? role = freezed,
|
||||
Object? permissions = freezed,
|
||||
Object? isActive = freezed,
|
||||
Object? createdAt = freezed,
|
||||
Object? updatedAt = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_$UserDtoImpl(
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
organizationId: freezed == organizationId
|
||||
? _value.organizationId
|
||||
: organizationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
outletId: freezed == outletId
|
||||
? _value.outletId
|
||||
: outletId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
name: freezed == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
email: freezed == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
role: freezed == role
|
||||
? _value.role
|
||||
: role // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
permissions: freezed == permissions
|
||||
? _value._permissions
|
||||
: permissions // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>?,
|
||||
isActive: freezed == isActive
|
||||
? _value.isActive
|
||||
: isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
createdAt: freezed == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
updatedAt: freezed == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$UserDtoImpl extends _UserDto {
|
||||
const _$UserDtoImpl({
|
||||
@JsonKey(name: 'id') this.id,
|
||||
@JsonKey(name: 'organization_id') this.organizationId,
|
||||
@JsonKey(name: 'outlet_id') this.outletId,
|
||||
@JsonKey(name: 'name') this.name,
|
||||
@JsonKey(name: 'email') this.email,
|
||||
@JsonKey(name: 'role') this.role,
|
||||
@JsonKey(name: 'permissions') final Map<String, dynamic>? permissions,
|
||||
@JsonKey(name: 'is_active') this.isActive,
|
||||
@JsonKey(name: 'created_at') this.createdAt,
|
||||
@JsonKey(name: 'updated_at') this.updatedAt,
|
||||
}) : _permissions = permissions,
|
||||
super._();
|
||||
|
||||
factory _$UserDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$UserDtoImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'id')
|
||||
final String? id;
|
||||
@override
|
||||
@JsonKey(name: 'organization_id')
|
||||
final String? organizationId;
|
||||
@override
|
||||
@JsonKey(name: 'outlet_id')
|
||||
final String? outletId;
|
||||
@override
|
||||
@JsonKey(name: 'name')
|
||||
final String? name;
|
||||
@override
|
||||
@JsonKey(name: 'email')
|
||||
final String? email;
|
||||
@override
|
||||
@JsonKey(name: 'role')
|
||||
final String? role;
|
||||
final Map<String, dynamic>? _permissions;
|
||||
@override
|
||||
@JsonKey(name: 'permissions')
|
||||
Map<String, dynamic>? get permissions {
|
||||
final value = _permissions;
|
||||
if (value == null) return null;
|
||||
if (_permissions is EqualUnmodifiableMapView) return _permissions;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(value);
|
||||
}
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'is_active')
|
||||
final bool? isActive;
|
||||
@override
|
||||
@JsonKey(name: 'created_at')
|
||||
final String? createdAt;
|
||||
@override
|
||||
@JsonKey(name: 'updated_at')
|
||||
final String? updatedAt;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserDto(id: $id, organizationId: $organizationId, outletId: $outletId, name: $name, email: $email, role: $role, permissions: $permissions, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$UserDtoImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.organizationId, organizationId) ||
|
||||
other.organizationId == organizationId) &&
|
||||
(identical(other.outletId, outletId) ||
|
||||
other.outletId == outletId) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.email, email) || other.email == email) &&
|
||||
(identical(other.role, role) || other.role == role) &&
|
||||
const DeepCollectionEquality().equals(
|
||||
other._permissions,
|
||||
_permissions,
|
||||
) &&
|
||||
(identical(other.isActive, isActive) ||
|
||||
other.isActive == isActive) &&
|
||||
(identical(other.createdAt, createdAt) ||
|
||||
other.createdAt == createdAt) &&
|
||||
(identical(other.updatedAt, updatedAt) ||
|
||||
other.updatedAt == updatedAt));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
organizationId,
|
||||
outletId,
|
||||
name,
|
||||
email,
|
||||
role,
|
||||
const DeepCollectionEquality().hash(_permissions),
|
||||
isActive,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
);
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$UserDtoImplCopyWith<_$UserDtoImpl> get copyWith =>
|
||||
__$$UserDtoImplCopyWithImpl<_$UserDtoImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$UserDtoImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _UserDto extends UserDto {
|
||||
const factory _UserDto({
|
||||
@JsonKey(name: 'id') final String? id,
|
||||
@JsonKey(name: 'organization_id') final String? organizationId,
|
||||
@JsonKey(name: 'outlet_id') final String? outletId,
|
||||
@JsonKey(name: 'name') final String? name,
|
||||
@JsonKey(name: 'email') final String? email,
|
||||
@JsonKey(name: 'role') final String? role,
|
||||
@JsonKey(name: 'permissions') final Map<String, dynamic>? permissions,
|
||||
@JsonKey(name: 'is_active') final bool? isActive,
|
||||
@JsonKey(name: 'created_at') final String? createdAt,
|
||||
@JsonKey(name: 'updated_at') final String? updatedAt,
|
||||
}) = _$UserDtoImpl;
|
||||
const _UserDto._() : super._();
|
||||
|
||||
factory _UserDto.fromJson(Map<String, dynamic> json) = _$UserDtoImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'id')
|
||||
String? get id;
|
||||
@override
|
||||
@JsonKey(name: 'organization_id')
|
||||
String? get organizationId;
|
||||
@override
|
||||
@JsonKey(name: 'outlet_id')
|
||||
String? get outletId;
|
||||
@override
|
||||
@JsonKey(name: 'name')
|
||||
String? get name;
|
||||
@override
|
||||
@JsonKey(name: 'email')
|
||||
String? get email;
|
||||
@override
|
||||
@JsonKey(name: 'role')
|
||||
String? get role;
|
||||
@override
|
||||
@JsonKey(name: 'permissions')
|
||||
Map<String, dynamic>? get permissions;
|
||||
@override
|
||||
@JsonKey(name: 'is_active')
|
||||
bool? get isActive;
|
||||
@override
|
||||
@JsonKey(name: 'created_at')
|
||||
String? get createdAt;
|
||||
@override
|
||||
@JsonKey(name: 'updated_at')
|
||||
String? get updatedAt;
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$UserDtoImplCopyWith<_$UserDtoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@ -21,31 +21,3 @@ Map<String, dynamic> _$$AuthDtoImplToJson(_$AuthDtoImpl instance) =>
|
||||
'expires_at': instance.expiresAt,
|
||||
'user': instance.user,
|
||||
};
|
||||
|
||||
_$UserDtoImpl _$$UserDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
_$UserDtoImpl(
|
||||
id: json['id'] as String?,
|
||||
organizationId: json['organization_id'] as String?,
|
||||
outletId: json['outlet_id'] as String?,
|
||||
name: json['name'] as String?,
|
||||
email: json['email'] as String?,
|
||||
role: json['role'] as String?,
|
||||
permissions: json['permissions'] as Map<String, dynamic>?,
|
||||
isActive: json['is_active'] as bool?,
|
||||
createdAt: json['created_at'] as String?,
|
||||
updatedAt: json['updated_at'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$UserDtoImplToJson(_$UserDtoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'organization_id': instance.organizationId,
|
||||
'outlet_id': instance.outletId,
|
||||
'name': instance.name,
|
||||
'email': instance.email,
|
||||
'role': instance.role,
|
||||
'permissions': instance.permissions,
|
||||
'is_active': instance.isActive,
|
||||
'created_at': instance.createdAt,
|
||||
'updated_at': instance.updatedAt,
|
||||
};
|
||||
|
||||
@ -5,8 +5,8 @@ import 'package:injectable/injectable.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../../common/constant/local_storage_key.dart';
|
||||
import '../../../domain/auth/auth.dart';
|
||||
import '../auth_dtos.dart';
|
||||
import '../../../domain/user/user.dart';
|
||||
import '../../user/user_dtos.dart';
|
||||
|
||||
@injectable
|
||||
class AuthLocalDataProvider {
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:dartz/dartz.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/auth/auth.dart';
|
||||
import '../../../domain/user/user.dart';
|
||||
import '../datasources/local_data_provider.dart';
|
||||
import '../datasources/remote_data_provider.dart';
|
||||
|
||||
|
||||
50
lib/infrastructure/user/datasource/remote_data_provider.dart
Normal file
50
lib/infrastructure/user/datasource/remote_data_provider.dart
Normal file
@ -0,0 +1,50 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:data_channel/data_channel.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../common/api/api_client.dart';
|
||||
import '../../../common/api/api_failure.dart';
|
||||
import '../../../common/function/app_function.dart';
|
||||
import '../../../common/url/api_path.dart';
|
||||
import '../../../domain/user/user.dart';
|
||||
import '../user_dtos.dart';
|
||||
|
||||
@injectable
|
||||
class UserRemoteDataProvider {
|
||||
final ApiClient _apiClient;
|
||||
|
||||
static const _logName = 'UserRemoteDataProvider';
|
||||
|
||||
UserRemoteDataProvider(this._apiClient);
|
||||
|
||||
Future<DC<UserFailure, UserDto>> updateUser({
|
||||
required String name,
|
||||
required String userId,
|
||||
}) async {
|
||||
try {
|
||||
final response = await _apiClient.put(
|
||||
'${ApiPath.user}/$userId',
|
||||
data: {'name': name, 'is_active': true},
|
||||
headers: getAuthorizationHeader(),
|
||||
);
|
||||
|
||||
if (response.statusCode == 400) {
|
||||
return DC.error(UserFailure.unexpectedError());
|
||||
}
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
return DC.error(
|
||||
UserFailure.dynamicErrorMessage(response.data['message']),
|
||||
);
|
||||
}
|
||||
|
||||
final dto = UserDto.fromJson(response.data);
|
||||
|
||||
return DC.data(dto);
|
||||
} on ApiFailure catch (e, s) {
|
||||
log('updateUser', name: _logName, error: e, stackTrace: s);
|
||||
return DC.error(UserFailure.serverError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
part of '../auth_dtos.dart';
|
||||
part of '../user_dtos.dart';
|
||||
|
||||
@freezed
|
||||
class UserDto with _$UserDto {
|
||||
42
lib/infrastructure/user/repositories/user_repository.dart
Normal file
42
lib/infrastructure/user/repositories/user_repository.dart
Normal file
@ -0,0 +1,42 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/user/user.dart';
|
||||
import '../../auth/datasources/local_data_provider.dart';
|
||||
import '../datasource/remote_data_provider.dart';
|
||||
|
||||
@Injectable(as: IUserRepository)
|
||||
class UserRepository implements IUserRepository {
|
||||
final UserRemoteDataProvider _dataProvider;
|
||||
final AuthLocalDataProvider _authLocalDataProvider;
|
||||
|
||||
final String _logName = 'UserRepository';
|
||||
|
||||
UserRepository(this._dataProvider, this._authLocalDataProvider);
|
||||
|
||||
@override
|
||||
Future<Either<UserFailure, User>> editUser({required String name}) async {
|
||||
try {
|
||||
User currentUser = await _authLocalDataProvider.currentUser();
|
||||
final result = await _dataProvider.updateUser(
|
||||
name: name,
|
||||
userId: currentUser.id,
|
||||
);
|
||||
|
||||
if (result.hasError) {
|
||||
return left(result.error!);
|
||||
}
|
||||
|
||||
final auth = result.data!.toDomain();
|
||||
|
||||
await _authLocalDataProvider.saveCurrentUser(result.data!);
|
||||
|
||||
return right(auth);
|
||||
} catch (e, s) {
|
||||
log('editUserError', name: _logName, error: e, stackTrace: s);
|
||||
return left(const UserFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
}
|
||||
8
lib/infrastructure/user/user_dtos.dart
Normal file
8
lib/infrastructure/user/user_dtos.dart
Normal file
@ -0,0 +1,8 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../../domain/user/user.dart';
|
||||
|
||||
part 'user_dtos.freezed.dart';
|
||||
part 'user_dtos.g.dart';
|
||||
|
||||
part 'dto/user_dto.dart';
|
||||
414
lib/infrastructure/user/user_dtos.freezed.dart
Normal file
414
lib/infrastructure/user/user_dtos.freezed.dart
Normal file
@ -0,0 +1,414 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// 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_dtos.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
UserDto _$UserDtoFromJson(Map<String, dynamic> json) {
|
||||
return _UserDto.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UserDto {
|
||||
@JsonKey(name: 'id')
|
||||
String? get id => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'organization_id')
|
||||
String? get organizationId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'outlet_id')
|
||||
String? get outletId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'name')
|
||||
String? get name => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'email')
|
||||
String? get email => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'role')
|
||||
String? get role => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'permissions')
|
||||
Map<String, dynamic>? get permissions => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'is_active')
|
||||
bool? get isActive => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'created_at')
|
||||
String? get createdAt => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'updated_at')
|
||||
String? get updatedAt => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this UserDto to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$UserDtoCopyWith<UserDto> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $UserDtoCopyWith<$Res> {
|
||||
factory $UserDtoCopyWith(UserDto value, $Res Function(UserDto) then) =
|
||||
_$UserDtoCopyWithImpl<$Res, UserDto>;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'id') String? id,
|
||||
@JsonKey(name: 'organization_id') String? organizationId,
|
||||
@JsonKey(name: 'outlet_id') String? outletId,
|
||||
@JsonKey(name: 'name') String? name,
|
||||
@JsonKey(name: 'email') String? email,
|
||||
@JsonKey(name: 'role') String? role,
|
||||
@JsonKey(name: 'permissions') Map<String, dynamic>? permissions,
|
||||
@JsonKey(name: 'is_active') bool? isActive,
|
||||
@JsonKey(name: 'created_at') String? createdAt,
|
||||
@JsonKey(name: 'updated_at') String? updatedAt,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$UserDtoCopyWithImpl<$Res, $Val extends UserDto>
|
||||
implements $UserDtoCopyWith<$Res> {
|
||||
_$UserDtoCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = freezed,
|
||||
Object? organizationId = freezed,
|
||||
Object? outletId = freezed,
|
||||
Object? name = freezed,
|
||||
Object? email = freezed,
|
||||
Object? role = freezed,
|
||||
Object? permissions = freezed,
|
||||
Object? isActive = freezed,
|
||||
Object? createdAt = freezed,
|
||||
Object? updatedAt = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
organizationId: freezed == organizationId
|
||||
? _value.organizationId
|
||||
: organizationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
outletId: freezed == outletId
|
||||
? _value.outletId
|
||||
: outletId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
name: freezed == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
email: freezed == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
role: freezed == role
|
||||
? _value.role
|
||||
: role // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
permissions: freezed == permissions
|
||||
? _value.permissions
|
||||
: permissions // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>?,
|
||||
isActive: freezed == isActive
|
||||
? _value.isActive
|
||||
: isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
createdAt: freezed == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
updatedAt: freezed == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$UserDtoImplCopyWith<$Res> implements $UserDtoCopyWith<$Res> {
|
||||
factory _$$UserDtoImplCopyWith(
|
||||
_$UserDtoImpl value,
|
||||
$Res Function(_$UserDtoImpl) then,
|
||||
) = __$$UserDtoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'id') String? id,
|
||||
@JsonKey(name: 'organization_id') String? organizationId,
|
||||
@JsonKey(name: 'outlet_id') String? outletId,
|
||||
@JsonKey(name: 'name') String? name,
|
||||
@JsonKey(name: 'email') String? email,
|
||||
@JsonKey(name: 'role') String? role,
|
||||
@JsonKey(name: 'permissions') Map<String, dynamic>? permissions,
|
||||
@JsonKey(name: 'is_active') bool? isActive,
|
||||
@JsonKey(name: 'created_at') String? createdAt,
|
||||
@JsonKey(name: 'updated_at') String? updatedAt,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$UserDtoImplCopyWithImpl<$Res>
|
||||
extends _$UserDtoCopyWithImpl<$Res, _$UserDtoImpl>
|
||||
implements _$$UserDtoImplCopyWith<$Res> {
|
||||
__$$UserDtoImplCopyWithImpl(
|
||||
_$UserDtoImpl _value,
|
||||
$Res Function(_$UserDtoImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = freezed,
|
||||
Object? organizationId = freezed,
|
||||
Object? outletId = freezed,
|
||||
Object? name = freezed,
|
||||
Object? email = freezed,
|
||||
Object? role = freezed,
|
||||
Object? permissions = freezed,
|
||||
Object? isActive = freezed,
|
||||
Object? createdAt = freezed,
|
||||
Object? updatedAt = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_$UserDtoImpl(
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
organizationId: freezed == organizationId
|
||||
? _value.organizationId
|
||||
: organizationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
outletId: freezed == outletId
|
||||
? _value.outletId
|
||||
: outletId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
name: freezed == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
email: freezed == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
role: freezed == role
|
||||
? _value.role
|
||||
: role // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
permissions: freezed == permissions
|
||||
? _value._permissions
|
||||
: permissions // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>?,
|
||||
isActive: freezed == isActive
|
||||
? _value.isActive
|
||||
: isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
createdAt: freezed == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
updatedAt: freezed == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$UserDtoImpl extends _UserDto {
|
||||
const _$UserDtoImpl({
|
||||
@JsonKey(name: 'id') this.id,
|
||||
@JsonKey(name: 'organization_id') this.organizationId,
|
||||
@JsonKey(name: 'outlet_id') this.outletId,
|
||||
@JsonKey(name: 'name') this.name,
|
||||
@JsonKey(name: 'email') this.email,
|
||||
@JsonKey(name: 'role') this.role,
|
||||
@JsonKey(name: 'permissions') final Map<String, dynamic>? permissions,
|
||||
@JsonKey(name: 'is_active') this.isActive,
|
||||
@JsonKey(name: 'created_at') this.createdAt,
|
||||
@JsonKey(name: 'updated_at') this.updatedAt,
|
||||
}) : _permissions = permissions,
|
||||
super._();
|
||||
|
||||
factory _$UserDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$UserDtoImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'id')
|
||||
final String? id;
|
||||
@override
|
||||
@JsonKey(name: 'organization_id')
|
||||
final String? organizationId;
|
||||
@override
|
||||
@JsonKey(name: 'outlet_id')
|
||||
final String? outletId;
|
||||
@override
|
||||
@JsonKey(name: 'name')
|
||||
final String? name;
|
||||
@override
|
||||
@JsonKey(name: 'email')
|
||||
final String? email;
|
||||
@override
|
||||
@JsonKey(name: 'role')
|
||||
final String? role;
|
||||
final Map<String, dynamic>? _permissions;
|
||||
@override
|
||||
@JsonKey(name: 'permissions')
|
||||
Map<String, dynamic>? get permissions {
|
||||
final value = _permissions;
|
||||
if (value == null) return null;
|
||||
if (_permissions is EqualUnmodifiableMapView) return _permissions;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(value);
|
||||
}
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'is_active')
|
||||
final bool? isActive;
|
||||
@override
|
||||
@JsonKey(name: 'created_at')
|
||||
final String? createdAt;
|
||||
@override
|
||||
@JsonKey(name: 'updated_at')
|
||||
final String? updatedAt;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserDto(id: $id, organizationId: $organizationId, outletId: $outletId, name: $name, email: $email, role: $role, permissions: $permissions, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$UserDtoImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.organizationId, organizationId) ||
|
||||
other.organizationId == organizationId) &&
|
||||
(identical(other.outletId, outletId) ||
|
||||
other.outletId == outletId) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.email, email) || other.email == email) &&
|
||||
(identical(other.role, role) || other.role == role) &&
|
||||
const DeepCollectionEquality().equals(
|
||||
other._permissions,
|
||||
_permissions,
|
||||
) &&
|
||||
(identical(other.isActive, isActive) ||
|
||||
other.isActive == isActive) &&
|
||||
(identical(other.createdAt, createdAt) ||
|
||||
other.createdAt == createdAt) &&
|
||||
(identical(other.updatedAt, updatedAt) ||
|
||||
other.updatedAt == updatedAt));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
organizationId,
|
||||
outletId,
|
||||
name,
|
||||
email,
|
||||
role,
|
||||
const DeepCollectionEquality().hash(_permissions),
|
||||
isActive,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
);
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$UserDtoImplCopyWith<_$UserDtoImpl> get copyWith =>
|
||||
__$$UserDtoImplCopyWithImpl<_$UserDtoImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$UserDtoImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _UserDto extends UserDto {
|
||||
const factory _UserDto({
|
||||
@JsonKey(name: 'id') final String? id,
|
||||
@JsonKey(name: 'organization_id') final String? organizationId,
|
||||
@JsonKey(name: 'outlet_id') final String? outletId,
|
||||
@JsonKey(name: 'name') final String? name,
|
||||
@JsonKey(name: 'email') final String? email,
|
||||
@JsonKey(name: 'role') final String? role,
|
||||
@JsonKey(name: 'permissions') final Map<String, dynamic>? permissions,
|
||||
@JsonKey(name: 'is_active') final bool? isActive,
|
||||
@JsonKey(name: 'created_at') final String? createdAt,
|
||||
@JsonKey(name: 'updated_at') final String? updatedAt,
|
||||
}) = _$UserDtoImpl;
|
||||
const _UserDto._() : super._();
|
||||
|
||||
factory _UserDto.fromJson(Map<String, dynamic> json) = _$UserDtoImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'id')
|
||||
String? get id;
|
||||
@override
|
||||
@JsonKey(name: 'organization_id')
|
||||
String? get organizationId;
|
||||
@override
|
||||
@JsonKey(name: 'outlet_id')
|
||||
String? get outletId;
|
||||
@override
|
||||
@JsonKey(name: 'name')
|
||||
String? get name;
|
||||
@override
|
||||
@JsonKey(name: 'email')
|
||||
String? get email;
|
||||
@override
|
||||
@JsonKey(name: 'role')
|
||||
String? get role;
|
||||
@override
|
||||
@JsonKey(name: 'permissions')
|
||||
Map<String, dynamic>? get permissions;
|
||||
@override
|
||||
@JsonKey(name: 'is_active')
|
||||
bool? get isActive;
|
||||
@override
|
||||
@JsonKey(name: 'created_at')
|
||||
String? get createdAt;
|
||||
@override
|
||||
@JsonKey(name: 'updated_at')
|
||||
String? get updatedAt;
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$UserDtoImplCopyWith<_$UserDtoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
35
lib/infrastructure/user/user_dtos.g.dart
Normal file
35
lib/infrastructure/user/user_dtos.g.dart
Normal file
@ -0,0 +1,35 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'user_dtos.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$UserDtoImpl _$$UserDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
_$UserDtoImpl(
|
||||
id: json['id'] as String?,
|
||||
organizationId: json['organization_id'] as String?,
|
||||
outletId: json['outlet_id'] as String?,
|
||||
name: json['name'] as String?,
|
||||
email: json['email'] as String?,
|
||||
role: json['role'] as String?,
|
||||
permissions: json['permissions'] as Map<String, dynamic>?,
|
||||
isActive: json['is_active'] as bool?,
|
||||
createdAt: json['created_at'] as String?,
|
||||
updatedAt: json['updated_at'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$UserDtoImplToJson(_$UserDtoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'organization_id': instance.organizationId,
|
||||
'outlet_id': instance.outletId,
|
||||
'name': instance.name,
|
||||
'email': instance.email,
|
||||
'role': instance.role,
|
||||
'permissions': instance.permissions,
|
||||
'is_active': instance.isActive,
|
||||
'created_at': instance.createdAt,
|
||||
'updated_at': instance.updatedAt,
|
||||
};
|
||||
@ -41,6 +41,8 @@ import 'package:apskel_owner_flutter/application/outlet/current_outlet_loader/cu
|
||||
as _i337;
|
||||
import 'package:apskel_owner_flutter/application/product/product_loader/product_loader_bloc.dart'
|
||||
as _i458;
|
||||
import 'package:apskel_owner_flutter/application/user/user_edit_form/user_edit_form_bloc.dart'
|
||||
as _i147;
|
||||
import 'package:apskel_owner_flutter/common/api/api_client.dart' as _i115;
|
||||
import 'package:apskel_owner_flutter/common/di/di_auto_route.dart' as _i311;
|
||||
import 'package:apskel_owner_flutter/common/di/di_connectivity.dart' as _i586;
|
||||
@ -58,6 +60,7 @@ import 'package:apskel_owner_flutter/domain/customer/customer.dart' as _i48;
|
||||
import 'package:apskel_owner_flutter/domain/order/order.dart' as _i219;
|
||||
import 'package:apskel_owner_flutter/domain/outlet/outlet.dart' as _i197;
|
||||
import 'package:apskel_owner_flutter/domain/product/product.dart' as _i419;
|
||||
import 'package:apskel_owner_flutter/domain/user/user.dart' as _i635;
|
||||
import 'package:apskel_owner_flutter/env.dart' as _i6;
|
||||
import 'package:apskel_owner_flutter/infrastructure/analytic/datasource/remote_data_provider.dart'
|
||||
as _i866;
|
||||
@ -89,6 +92,10 @@ import 'package:apskel_owner_flutter/infrastructure/product/datasources/remote_d
|
||||
as _i823;
|
||||
import 'package:apskel_owner_flutter/infrastructure/product/repositories/product_repository.dart'
|
||||
as _i121;
|
||||
import 'package:apskel_owner_flutter/infrastructure/user/datasource/remote_data_provider.dart'
|
||||
as _i785;
|
||||
import 'package:apskel_owner_flutter/infrastructure/user/repositories/user_repository.dart'
|
||||
as _i754;
|
||||
import 'package:apskel_owner_flutter/presentation/router/app_router.dart'
|
||||
as _i258;
|
||||
import 'package:connectivity_plus/connectivity_plus.dart' as _i895;
|
||||
@ -159,6 +166,9 @@ extension GetItInjectableX on _i174.GetIt {
|
||||
gh.factory<_i27.OutletRemoteDataProvider>(
|
||||
() => _i27.OutletRemoteDataProvider(gh<_i115.ApiClient>()),
|
||||
);
|
||||
gh.factory<_i785.UserRemoteDataProvider>(
|
||||
() => _i785.UserRemoteDataProvider(gh<_i115.ApiClient>()),
|
||||
);
|
||||
gh.factory<_i48.ICustomerRepository>(
|
||||
() => _i550.CustomerRepository(gh<_i1006.CustomerRemoteDataProvider>()),
|
||||
);
|
||||
@ -171,6 +181,12 @@ extension GetItInjectableX on _i174.GetIt {
|
||||
gh<_i17.AuthRemoteDataProvider>(),
|
||||
),
|
||||
);
|
||||
gh.factory<_i635.IUserRepository>(
|
||||
() => _i754.UserRepository(
|
||||
gh<_i785.UserRemoteDataProvider>(),
|
||||
gh<_i991.AuthLocalDataProvider>(),
|
||||
),
|
||||
);
|
||||
gh.factory<_i419.IProductRepository>(
|
||||
() => _i121.ProductRepository(gh<_i823.ProductRemoteDataProvider>()),
|
||||
);
|
||||
@ -239,6 +255,9 @@ extension GetItInjectableX on _i174.GetIt {
|
||||
gh.factory<_i1058.OrderLoaderBloc>(
|
||||
() => _i1058.OrderLoaderBloc(gh<_i219.IOrderRepository>()),
|
||||
);
|
||||
gh.factory<_i147.UserEditFormBloc>(
|
||||
() => _i147.UserEditFormBloc(gh<_i635.IUserRepository>()),
|
||||
);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,17 +7,20 @@ class AppElevatedButton extends StatelessWidget {
|
||||
required this.isLoading,
|
||||
required this.onPressed,
|
||||
this.height = 50,
|
||||
this.width = double.infinity,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final bool isLoading;
|
||||
final Function()? onPressed;
|
||||
final double height;
|
||||
final double width;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: height,
|
||||
width: width,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(colors: AppColor.primaryGradient),
|
||||
borderRadius: BorderRadius.circular(AppValue.radius),
|
||||
|
||||
@ -9,6 +9,7 @@ class AppTextFormField extends StatelessWidget {
|
||||
required this.prefixIcon,
|
||||
this.validator,
|
||||
this.onChanged,
|
||||
this.keyboardType = TextInputType.text,
|
||||
});
|
||||
|
||||
final TextEditingController? controller;
|
||||
@ -17,6 +18,7 @@ class AppTextFormField extends StatelessWidget {
|
||||
final IconData prefixIcon;
|
||||
final String? Function(String?)? validator;
|
||||
final Function(String)? onChanged;
|
||||
final TextInputType keyboardType;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -33,7 +35,7 @@ class AppTextFormField extends StatelessWidget {
|
||||
const SpaceHeight(8),
|
||||
TextFormField(
|
||||
controller: controller,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
keyboardType: keyboardType,
|
||||
cursorColor: AppColor.primary,
|
||||
onChanged: onChanged,
|
||||
style: AppStyle.md.copyWith(color: AppColor.textPrimary),
|
||||
|
||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../common/theme/theme.dart';
|
||||
import '../../../domain/auth/auth.dart';
|
||||
import '../../../domain/user/user.dart';
|
||||
|
||||
class AppFlushbar {
|
||||
static void showSuccess(BuildContext context, String message) {
|
||||
@ -51,4 +52,15 @@ class AppFlushbar {
|
||||
unexpectedError: (value) => 'Error has eccoured',
|
||||
),
|
||||
);
|
||||
|
||||
static void showUserFailureToast(BuildContext context, UserFailure failure) =>
|
||||
showError(
|
||||
context,
|
||||
failure.map(
|
||||
serverError: (value) => value.failure.toStringFormatted(context),
|
||||
dynamicErrorMessage: (value) => value.erroMessage,
|
||||
unexpectedError: (value) => 'Error has eccoured',
|
||||
empty: (value) => 'Data not found',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import '../../../../common/constant/app_constant.dart';
|
||||
import '../../../../common/extension/extension.dart';
|
||||
import '../../../../common/painter/wave_painter.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../../domain/auth/auth.dart';
|
||||
import '../../../../domain/user/user.dart';
|
||||
import '../../../components/spacer/spacer.dart';
|
||||
|
||||
class HomeHeader extends StatefulWidget {
|
||||
|
||||
@ -0,0 +1,108 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../../application/auth/auth_bloc.dart';
|
||||
import '../../../../../application/user/user_edit_form/user_edit_form_bloc.dart';
|
||||
import '../../../../../common/theme/theme.dart';
|
||||
import '../../../../../domain/user/user.dart';
|
||||
import '../../../../../injection.dart';
|
||||
import '../../../../components/appbar/appbar.dart';
|
||||
import '../../../../components/button/button.dart';
|
||||
import '../../../../components/spacer/spacer.dart';
|
||||
import '../../../../components/toast/flushbar.dart';
|
||||
import 'widgets/name_field.dart';
|
||||
|
||||
@RoutePage()
|
||||
class ProfileEditPage extends StatefulWidget implements AutoRouteWrapper {
|
||||
final User user;
|
||||
const ProfileEditPage({super.key, required this.user});
|
||||
|
||||
@override
|
||||
State<ProfileEditPage> createState() => _ProfileEditPageState();
|
||||
|
||||
@override
|
||||
Widget wrappedRoute(BuildContext context) =>
|
||||
BlocProvider(create: (_) => getIt<UserEditFormBloc>(), child: this);
|
||||
}
|
||||
|
||||
class _ProfileEditPageState extends State<ProfileEditPage> {
|
||||
TextEditingController nameController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
nameController = TextEditingController(text: widget.user.name);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocListener<UserEditFormBloc, UserEditFormState>(
|
||||
listenWhen: (p, c) => p.failureOrUserOption != c.failureOrUserOption,
|
||||
listener: (context, state) {
|
||||
state.failureOrUserOption.fold(
|
||||
() => null,
|
||||
(either) => either.fold(
|
||||
(f) => AppFlushbar.showUserFailureToast(context, f),
|
||||
(user) {
|
||||
if (context.mounted) {
|
||||
context.read<AuthBloc>().add(AuthEvent.fetchCurrentUser());
|
||||
context.router.back();
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: AppColor.background,
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
// SliverAppBar with gradient
|
||||
SliverAppBar(
|
||||
expandedHeight: 120,
|
||||
floating: false,
|
||||
pinned: true,
|
||||
elevation: 0,
|
||||
backgroundColor: AppColor.primary,
|
||||
flexibleSpace: CustomAppBar(title: 'Profile Edit'),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: BlocBuilder<UserEditFormBloc, UserEditFormState>(
|
||||
builder: (context, state) {
|
||||
return Container(
|
||||
margin: EdgeInsets.all(AppValue.margin),
|
||||
padding: EdgeInsets.all(AppValue.padding),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.white,
|
||||
borderRadius: BorderRadius.circular(AppValue.radius),
|
||||
),
|
||||
child: Form(
|
||||
autovalidateMode: state.showErrorMessages
|
||||
? AutovalidateMode.always
|
||||
: AutovalidateMode.disabled,
|
||||
child: Column(
|
||||
children: [
|
||||
ProfileEditNameField(controller: nameController),
|
||||
SpaceHeight(24),
|
||||
AppElevatedButton(
|
||||
text: 'Save',
|
||||
isLoading: state.isSubmitting,
|
||||
onPressed: () {
|
||||
context.read<UserEditFormBloc>().add(
|
||||
UserEditFormEvent.submitted(),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:line_icons/line_icons.dart';
|
||||
|
||||
import '../../../../../../application/user/user_edit_form/user_edit_form_bloc.dart';
|
||||
import '../../../../../components/field/field.dart';
|
||||
|
||||
class ProfileEditNameField extends StatelessWidget {
|
||||
final TextEditingController controller;
|
||||
const ProfileEditNameField({super.key, required this.controller});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppTextFormField(
|
||||
title: 'Name',
|
||||
prefixIcon: LineIcons.user,
|
||||
hintText: 'Please enter your name',
|
||||
controller: controller,
|
||||
onChanged: (value) {
|
||||
context.read<UserEditFormBloc>().add(
|
||||
UserEditFormEvent.nameChanged(value),
|
||||
);
|
||||
},
|
||||
validator: (value) {
|
||||
if (context.read<UserEditFormBloc>().state.name.isEmpty) {
|
||||
return 'Please enter your name';
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -98,7 +98,9 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
||||
),
|
||||
),
|
||||
ActionIconButton(
|
||||
onTap: () {},
|
||||
onTap: () => context.router.push(
|
||||
ProfileEditRoute(user: state.user),
|
||||
),
|
||||
icon: LineIcons.userEdit,
|
||||
),
|
||||
],
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:line_icons/line_icons.dart';
|
||||
|
||||
import '../../../../common/extension/extension.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../../domain/auth/auth.dart';
|
||||
import '../../../../domain/user/user.dart';
|
||||
import '../../../router/app_router.gr.dart';
|
||||
import 'divider.dart';
|
||||
import 'profile_tile.dart';
|
||||
|
||||
@ -45,9 +47,7 @@ class ProfileAccountInfo extends StatelessWidget {
|
||||
icon: LineIcons.envelope,
|
||||
title: 'Email',
|
||||
subtitle: user.email,
|
||||
onTap: () {
|
||||
// Edit email
|
||||
},
|
||||
showArrow: false,
|
||||
),
|
||||
|
||||
ProfileDivider(),
|
||||
@ -64,7 +64,7 @@ class ProfileAccountInfo extends StatelessWidget {
|
||||
icon: LineIcons.userEdit,
|
||||
title: 'Ubah Profil',
|
||||
subtitle: 'Ubah profil kamu',
|
||||
showArrow: false,
|
||||
onTap: () => context.router.push(ProfileEditRoute(user: user)),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -4,7 +4,7 @@ import 'dart:math' as math;
|
||||
import '../../../../common/extension/extension.dart';
|
||||
import '../../../../common/painter/wave_painter.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../../domain/auth/auth.dart';
|
||||
import '../../../../domain/user/user.dart';
|
||||
import '../../../components/spacer/spacer.dart';
|
||||
|
||||
class ProfileHeader extends StatefulWidget {
|
||||
|
||||
@ -59,6 +59,9 @@ class AppRouter extends RootStackRouter {
|
||||
// Download Report
|
||||
AutoRoute(page: DownloadReportRoute.page),
|
||||
|
||||
// Profile
|
||||
AutoRoute(page: ProfileEditRoute.page),
|
||||
|
||||
// Error
|
||||
AutoRoute(page: ErrorRoute.page),
|
||||
|
||||
|
||||
@ -9,7 +9,8 @@
|
||||
// coverage:ignore-file
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:apskel_owner_flutter/domain/order/order.dart' as _i25;
|
||||
import 'package:apskel_owner_flutter/domain/order/order.dart' as _i26;
|
||||
import 'package:apskel_owner_flutter/domain/user/user.dart' as _i27;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/auth/login/login_page.dart'
|
||||
as _i10;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/coming_soon/coming_soon_page.dart'
|
||||
@ -42,30 +43,32 @@ import 'package:apskel_owner_flutter/presentation/pages/product/product_analytic
|
||||
as _i15;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/product/product_list/product_page.dart'
|
||||
as _i16;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/profile/profile_page.dart'
|
||||
import 'package:apskel_owner_flutter/presentation/pages/profile/pages/profile_edit/profile_edit_page.dart'
|
||||
as _i17;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/purchase/purchase_page.dart'
|
||||
import 'package:apskel_owner_flutter/presentation/pages/profile/profile_page.dart'
|
||||
as _i18;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/report/report_page.dart'
|
||||
import 'package:apskel_owner_flutter/presentation/pages/purchase/purchase_page.dart'
|
||||
as _i19;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/sales/sales_page.dart'
|
||||
import 'package:apskel_owner_flutter/presentation/pages/report/report_page.dart'
|
||||
as _i20;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/schedule/schedule_page.dart'
|
||||
import 'package:apskel_owner_flutter/presentation/pages/sales/sales_page.dart'
|
||||
as _i21;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/splash/splash_page.dart'
|
||||
import 'package:apskel_owner_flutter/presentation/pages/schedule/schedule_page.dart'
|
||||
as _i22;
|
||||
import 'package:auto_route/auto_route.dart' as _i23;
|
||||
import 'package:flutter/material.dart' as _i24;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/splash/splash_page.dart'
|
||||
as _i23;
|
||||
import 'package:auto_route/auto_route.dart' as _i24;
|
||||
import 'package:flutter/material.dart' as _i25;
|
||||
|
||||
/// generated route for
|
||||
/// [_i1.ComingSoonPage]
|
||||
class ComingSoonRoute extends _i23.PageRouteInfo<void> {
|
||||
const ComingSoonRoute({List<_i23.PageRouteInfo>? children})
|
||||
class ComingSoonRoute extends _i24.PageRouteInfo<void> {
|
||||
const ComingSoonRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(ComingSoonRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'ComingSoonRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i1.ComingSoonPage();
|
||||
@ -75,29 +78,29 @@ class ComingSoonRoute extends _i23.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i2.CustomerPage]
|
||||
class CustomerRoute extends _i23.PageRouteInfo<void> {
|
||||
const CustomerRoute({List<_i23.PageRouteInfo>? children})
|
||||
class CustomerRoute extends _i24.PageRouteInfo<void> {
|
||||
const CustomerRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(CustomerRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'CustomerRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i23.WrappedRoute(child: const _i2.CustomerPage());
|
||||
return _i24.WrappedRoute(child: const _i2.CustomerPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i3.DailyTasksFormPage]
|
||||
class DailyTasksFormRoute extends _i23.PageRouteInfo<void> {
|
||||
const DailyTasksFormRoute({List<_i23.PageRouteInfo>? children})
|
||||
class DailyTasksFormRoute extends _i24.PageRouteInfo<void> {
|
||||
const DailyTasksFormRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(DailyTasksFormRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'DailyTasksFormRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i3.DailyTasksFormPage();
|
||||
@ -107,13 +110,13 @@ class DailyTasksFormRoute extends _i23.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i4.DownloadReportPage]
|
||||
class DownloadReportRoute extends _i23.PageRouteInfo<void> {
|
||||
const DownloadReportRoute({List<_i23.PageRouteInfo>? children})
|
||||
class DownloadReportRoute extends _i24.PageRouteInfo<void> {
|
||||
const DownloadReportRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(DownloadReportRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'DownloadReportRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i4.DownloadReportPage();
|
||||
@ -123,16 +126,16 @@ class DownloadReportRoute extends _i23.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i5.ErrorPage]
|
||||
class ErrorRoute extends _i23.PageRouteInfo<ErrorRouteArgs> {
|
||||
class ErrorRoute extends _i24.PageRouteInfo<ErrorRouteArgs> {
|
||||
ErrorRoute({
|
||||
_i24.Key? key,
|
||||
_i25.Key? key,
|
||||
String? title,
|
||||
String? message,
|
||||
_i24.VoidCallback? onRetry,
|
||||
_i24.VoidCallback? onBack,
|
||||
_i25.VoidCallback? onRetry,
|
||||
_i25.VoidCallback? onBack,
|
||||
String? errorCode,
|
||||
_i24.IconData? errorIcon,
|
||||
List<_i23.PageRouteInfo>? children,
|
||||
_i25.IconData? errorIcon,
|
||||
List<_i24.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
ErrorRoute.name,
|
||||
args: ErrorRouteArgs(
|
||||
@ -149,7 +152,7 @@ class ErrorRoute extends _i23.PageRouteInfo<ErrorRouteArgs> {
|
||||
|
||||
static const String name = 'ErrorRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args = data.argsAs<ErrorRouteArgs>(
|
||||
@ -179,19 +182,19 @@ class ErrorRouteArgs {
|
||||
this.errorIcon,
|
||||
});
|
||||
|
||||
final _i24.Key? key;
|
||||
final _i25.Key? key;
|
||||
|
||||
final String? title;
|
||||
|
||||
final String? message;
|
||||
|
||||
final _i24.VoidCallback? onRetry;
|
||||
final _i25.VoidCallback? onRetry;
|
||||
|
||||
final _i24.VoidCallback? onBack;
|
||||
final _i25.VoidCallback? onBack;
|
||||
|
||||
final String? errorCode;
|
||||
|
||||
final _i24.IconData? errorIcon;
|
||||
final _i25.IconData? errorIcon;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -201,61 +204,61 @@ class ErrorRouteArgs {
|
||||
|
||||
/// generated route for
|
||||
/// [_i6.FinancePage]
|
||||
class FinanceRoute extends _i23.PageRouteInfo<void> {
|
||||
const FinanceRoute({List<_i23.PageRouteInfo>? children})
|
||||
class FinanceRoute extends _i24.PageRouteInfo<void> {
|
||||
const FinanceRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(FinanceRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'FinanceRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i23.WrappedRoute(child: const _i6.FinancePage());
|
||||
return _i24.WrappedRoute(child: const _i6.FinancePage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i7.HomePage]
|
||||
class HomeRoute extends _i23.PageRouteInfo<void> {
|
||||
const HomeRoute({List<_i23.PageRouteInfo>? children})
|
||||
class HomeRoute extends _i24.PageRouteInfo<void> {
|
||||
const HomeRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(HomeRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'HomeRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i23.WrappedRoute(child: const _i7.HomePage());
|
||||
return _i24.WrappedRoute(child: const _i7.HomePage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i8.InventoryPage]
|
||||
class InventoryRoute extends _i23.PageRouteInfo<void> {
|
||||
const InventoryRoute({List<_i23.PageRouteInfo>? children})
|
||||
class InventoryRoute extends _i24.PageRouteInfo<void> {
|
||||
const InventoryRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(InventoryRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'InventoryRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i23.WrappedRoute(child: const _i8.InventoryPage());
|
||||
return _i24.WrappedRoute(child: const _i8.InventoryPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i9.LanguagePage]
|
||||
class LanguageRoute extends _i23.PageRouteInfo<void> {
|
||||
const LanguageRoute({List<_i23.PageRouteInfo>? children})
|
||||
class LanguageRoute extends _i24.PageRouteInfo<void> {
|
||||
const LanguageRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(LanguageRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'LanguageRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i9.LanguagePage();
|
||||
@ -265,29 +268,29 @@ class LanguageRoute extends _i23.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i10.LoginPage]
|
||||
class LoginRoute extends _i23.PageRouteInfo<void> {
|
||||
const LoginRoute({List<_i23.PageRouteInfo>? children})
|
||||
class LoginRoute extends _i24.PageRouteInfo<void> {
|
||||
const LoginRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(LoginRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'LoginRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i23.WrappedRoute(child: const _i10.LoginPage());
|
||||
return _i24.WrappedRoute(child: const _i10.LoginPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i11.MainPage]
|
||||
class MainRoute extends _i23.PageRouteInfo<void> {
|
||||
const MainRoute({List<_i23.PageRouteInfo>? children})
|
||||
class MainRoute extends _i24.PageRouteInfo<void> {
|
||||
const MainRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(MainRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'MainRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i11.MainPage();
|
||||
@ -297,11 +300,11 @@ class MainRoute extends _i23.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i12.OrderDetailPage]
|
||||
class OrderDetailRoute extends _i23.PageRouteInfo<OrderDetailRouteArgs> {
|
||||
class OrderDetailRoute extends _i24.PageRouteInfo<OrderDetailRouteArgs> {
|
||||
OrderDetailRoute({
|
||||
_i24.Key? key,
|
||||
required _i25.Order order,
|
||||
List<_i23.PageRouteInfo>? children,
|
||||
_i25.Key? key,
|
||||
required _i26.Order order,
|
||||
List<_i24.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
OrderDetailRoute.name,
|
||||
args: OrderDetailRouteArgs(key: key, order: order),
|
||||
@ -310,7 +313,7 @@ class OrderDetailRoute extends _i23.PageRouteInfo<OrderDetailRouteArgs> {
|
||||
|
||||
static const String name = 'OrderDetailRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args = data.argsAs<OrderDetailRouteArgs>();
|
||||
@ -322,9 +325,9 @@ class OrderDetailRoute extends _i23.PageRouteInfo<OrderDetailRouteArgs> {
|
||||
class OrderDetailRouteArgs {
|
||||
const OrderDetailRouteArgs({this.key, required this.order});
|
||||
|
||||
final _i24.Key? key;
|
||||
final _i25.Key? key;
|
||||
|
||||
final _i25.Order order;
|
||||
final _i26.Order order;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -334,160 +337,197 @@ class OrderDetailRouteArgs {
|
||||
|
||||
/// generated route for
|
||||
/// [_i13.OrderPage]
|
||||
class OrderRoute extends _i23.PageRouteInfo<void> {
|
||||
const OrderRoute({List<_i23.PageRouteInfo>? children})
|
||||
class OrderRoute extends _i24.PageRouteInfo<void> {
|
||||
const OrderRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(OrderRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'OrderRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i23.WrappedRoute(child: const _i13.OrderPage());
|
||||
return _i24.WrappedRoute(child: const _i13.OrderPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i14.OutletInformationPage]
|
||||
class OutletInformationRoute extends _i23.PageRouteInfo<void> {
|
||||
const OutletInformationRoute({List<_i23.PageRouteInfo>? children})
|
||||
class OutletInformationRoute extends _i24.PageRouteInfo<void> {
|
||||
const OutletInformationRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(OutletInformationRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'OutletInformationRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i23.WrappedRoute(child: const _i14.OutletInformationPage());
|
||||
return _i24.WrappedRoute(child: const _i14.OutletInformationPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i15.ProductAnalyticPage]
|
||||
class ProductAnalyticRoute extends _i23.PageRouteInfo<void> {
|
||||
const ProductAnalyticRoute({List<_i23.PageRouteInfo>? children})
|
||||
class ProductAnalyticRoute extends _i24.PageRouteInfo<void> {
|
||||
const ProductAnalyticRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(ProductAnalyticRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'ProductAnalyticRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i23.WrappedRoute(child: const _i15.ProductAnalyticPage());
|
||||
return _i24.WrappedRoute(child: const _i15.ProductAnalyticPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i16.ProductPage]
|
||||
class ProductRoute extends _i23.PageRouteInfo<void> {
|
||||
const ProductRoute({List<_i23.PageRouteInfo>? children})
|
||||
class ProductRoute extends _i24.PageRouteInfo<void> {
|
||||
const ProductRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(ProductRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'ProductRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i23.WrappedRoute(child: const _i16.ProductPage());
|
||||
return _i24.WrappedRoute(child: const _i16.ProductPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i17.ProfilePage]
|
||||
class ProfileRoute extends _i23.PageRouteInfo<void> {
|
||||
const ProfileRoute({List<_i23.PageRouteInfo>? children})
|
||||
/// [_i17.ProfileEditPage]
|
||||
class ProfileEditRoute extends _i24.PageRouteInfo<ProfileEditRouteArgs> {
|
||||
ProfileEditRoute({
|
||||
_i25.Key? key,
|
||||
required _i27.User user,
|
||||
List<_i24.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
ProfileEditRoute.name,
|
||||
args: ProfileEditRouteArgs(key: key, user: user),
|
||||
initialChildren: children,
|
||||
);
|
||||
|
||||
static const String name = 'ProfileEditRoute';
|
||||
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args = data.argsAs<ProfileEditRouteArgs>();
|
||||
return _i17.ProfileEditPage(key: args.key, user: args.user);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class ProfileEditRouteArgs {
|
||||
const ProfileEditRouteArgs({this.key, required this.user});
|
||||
|
||||
final _i25.Key? key;
|
||||
|
||||
final _i27.User user;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfileEditRouteArgs{key: $key, user: $user}';
|
||||
}
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i18.ProfilePage]
|
||||
class ProfileRoute extends _i24.PageRouteInfo<void> {
|
||||
const ProfileRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(ProfileRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'ProfileRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i23.WrappedRoute(child: const _i17.ProfilePage());
|
||||
return _i24.WrappedRoute(child: const _i18.ProfilePage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i18.PurchasePage]
|
||||
class PurchaseRoute extends _i23.PageRouteInfo<void> {
|
||||
const PurchaseRoute({List<_i23.PageRouteInfo>? children})
|
||||
/// [_i19.PurchasePage]
|
||||
class PurchaseRoute extends _i24.PageRouteInfo<void> {
|
||||
const PurchaseRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(PurchaseRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'PurchaseRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i18.PurchasePage();
|
||||
return const _i19.PurchasePage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i19.ReportPage]
|
||||
class ReportRoute extends _i23.PageRouteInfo<void> {
|
||||
const ReportRoute({List<_i23.PageRouteInfo>? children})
|
||||
/// [_i20.ReportPage]
|
||||
class ReportRoute extends _i24.PageRouteInfo<void> {
|
||||
const ReportRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(ReportRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'ReportRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i23.WrappedRoute(child: const _i19.ReportPage());
|
||||
return _i24.WrappedRoute(child: const _i20.ReportPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i20.SalesPage]
|
||||
class SalesRoute extends _i23.PageRouteInfo<void> {
|
||||
const SalesRoute({List<_i23.PageRouteInfo>? children})
|
||||
/// [_i21.SalesPage]
|
||||
class SalesRoute extends _i24.PageRouteInfo<void> {
|
||||
const SalesRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(SalesRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'SalesRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return _i23.WrappedRoute(child: const _i20.SalesPage());
|
||||
return _i24.WrappedRoute(child: const _i21.SalesPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i21.SchedulePage]
|
||||
class ScheduleRoute extends _i23.PageRouteInfo<void> {
|
||||
const ScheduleRoute({List<_i23.PageRouteInfo>? children})
|
||||
/// [_i22.SchedulePage]
|
||||
class ScheduleRoute extends _i24.PageRouteInfo<void> {
|
||||
const ScheduleRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(ScheduleRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'ScheduleRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i21.SchedulePage();
|
||||
return const _i22.SchedulePage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i22.SplashPage]
|
||||
class SplashRoute extends _i23.PageRouteInfo<void> {
|
||||
const SplashRoute({List<_i23.PageRouteInfo>? children})
|
||||
/// [_i23.SplashPage]
|
||||
class SplashRoute extends _i24.PageRouteInfo<void> {
|
||||
const SplashRoute({List<_i24.PageRouteInfo>? children})
|
||||
: super(SplashRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'SplashRoute';
|
||||
|
||||
static _i23.PageInfo page = _i23.PageInfo(
|
||||
static _i24.PageInfo page = _i24.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i22.SplashPage();
|
||||
return const _i23.SplashPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user