feat: API 인증 시스템 구현 및 로그인 화면 연동
- AuthService, AuthRemoteDataSource 구현 - JWT 토큰 관리 (SecureStorage 사용) - 로그인 화면 API 연동 및 에러 처리 - freezed 패키지로 Auth 관련 DTO 모델 생성 - 의존성 주입 설정 업데이트
This commit is contained in:
280
lib/data/models/auth/login_response.freezed.dart
Normal file
280
lib/data/models/auth/login_response.freezed.dart
Normal file
@@ -0,0 +1,280 @@
|
||||
// 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 'login_response.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');
|
||||
|
||||
LoginResponse _$LoginResponseFromJson(Map<String, dynamic> json) {
|
||||
return _LoginResponse.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LoginResponse {
|
||||
@JsonKey(name: 'access_token')
|
||||
String get accessToken => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'refresh_token')
|
||||
String get refreshToken => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'token_type')
|
||||
String get tokenType => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'expires_in')
|
||||
int get expiresIn => throw _privateConstructorUsedError;
|
||||
AuthUser get user => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this LoginResponse to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of LoginResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$LoginResponseCopyWith<LoginResponse> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LoginResponseCopyWith<$Res> {
|
||||
factory $LoginResponseCopyWith(
|
||||
LoginResponse value, $Res Function(LoginResponse) then) =
|
||||
_$LoginResponseCopyWithImpl<$Res, LoginResponse>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'access_token') String accessToken,
|
||||
@JsonKey(name: 'refresh_token') String refreshToken,
|
||||
@JsonKey(name: 'token_type') String tokenType,
|
||||
@JsonKey(name: 'expires_in') int expiresIn,
|
||||
AuthUser user});
|
||||
|
||||
$AuthUserCopyWith<$Res> get user;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LoginResponseCopyWithImpl<$Res, $Val extends LoginResponse>
|
||||
implements $LoginResponseCopyWith<$Res> {
|
||||
_$LoginResponseCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of LoginResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? accessToken = null,
|
||||
Object? refreshToken = null,
|
||||
Object? tokenType = null,
|
||||
Object? expiresIn = null,
|
||||
Object? user = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
accessToken: null == accessToken
|
||||
? _value.accessToken
|
||||
: accessToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
refreshToken: null == refreshToken
|
||||
? _value.refreshToken
|
||||
: refreshToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
tokenType: null == tokenType
|
||||
? _value.tokenType
|
||||
: tokenType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
expiresIn: null == expiresIn
|
||||
? _value.expiresIn
|
||||
: expiresIn // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
user: null == user
|
||||
? _value.user
|
||||
: user // ignore: cast_nullable_to_non_nullable
|
||||
as AuthUser,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
/// Create a copy of LoginResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$AuthUserCopyWith<$Res> get user {
|
||||
return $AuthUserCopyWith<$Res>(_value.user, (value) {
|
||||
return _then(_value.copyWith(user: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoginResponseImplCopyWith<$Res>
|
||||
implements $LoginResponseCopyWith<$Res> {
|
||||
factory _$$LoginResponseImplCopyWith(
|
||||
_$LoginResponseImpl value, $Res Function(_$LoginResponseImpl) then) =
|
||||
__$$LoginResponseImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'access_token') String accessToken,
|
||||
@JsonKey(name: 'refresh_token') String refreshToken,
|
||||
@JsonKey(name: 'token_type') String tokenType,
|
||||
@JsonKey(name: 'expires_in') int expiresIn,
|
||||
AuthUser user});
|
||||
|
||||
@override
|
||||
$AuthUserCopyWith<$Res> get user;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoginResponseImplCopyWithImpl<$Res>
|
||||
extends _$LoginResponseCopyWithImpl<$Res, _$LoginResponseImpl>
|
||||
implements _$$LoginResponseImplCopyWith<$Res> {
|
||||
__$$LoginResponseImplCopyWithImpl(
|
||||
_$LoginResponseImpl _value, $Res Function(_$LoginResponseImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LoginResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? accessToken = null,
|
||||
Object? refreshToken = null,
|
||||
Object? tokenType = null,
|
||||
Object? expiresIn = null,
|
||||
Object? user = null,
|
||||
}) {
|
||||
return _then(_$LoginResponseImpl(
|
||||
accessToken: null == accessToken
|
||||
? _value.accessToken
|
||||
: accessToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
refreshToken: null == refreshToken
|
||||
? _value.refreshToken
|
||||
: refreshToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
tokenType: null == tokenType
|
||||
? _value.tokenType
|
||||
: tokenType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
expiresIn: null == expiresIn
|
||||
? _value.expiresIn
|
||||
: expiresIn // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
user: null == user
|
||||
? _value.user
|
||||
: user // ignore: cast_nullable_to_non_nullable
|
||||
as AuthUser,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$LoginResponseImpl implements _LoginResponse {
|
||||
const _$LoginResponseImpl(
|
||||
{@JsonKey(name: 'access_token') required this.accessToken,
|
||||
@JsonKey(name: 'refresh_token') required this.refreshToken,
|
||||
@JsonKey(name: 'token_type') required this.tokenType,
|
||||
@JsonKey(name: 'expires_in') required this.expiresIn,
|
||||
required this.user});
|
||||
|
||||
factory _$LoginResponseImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$LoginResponseImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'access_token')
|
||||
final String accessToken;
|
||||
@override
|
||||
@JsonKey(name: 'refresh_token')
|
||||
final String refreshToken;
|
||||
@override
|
||||
@JsonKey(name: 'token_type')
|
||||
final String tokenType;
|
||||
@override
|
||||
@JsonKey(name: 'expires_in')
|
||||
final int expiresIn;
|
||||
@override
|
||||
final AuthUser user;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginResponse(accessToken: $accessToken, refreshToken: $refreshToken, tokenType: $tokenType, expiresIn: $expiresIn, user: $user)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LoginResponseImpl &&
|
||||
(identical(other.accessToken, accessToken) ||
|
||||
other.accessToken == accessToken) &&
|
||||
(identical(other.refreshToken, refreshToken) ||
|
||||
other.refreshToken == refreshToken) &&
|
||||
(identical(other.tokenType, tokenType) ||
|
||||
other.tokenType == tokenType) &&
|
||||
(identical(other.expiresIn, expiresIn) ||
|
||||
other.expiresIn == expiresIn) &&
|
||||
(identical(other.user, user) || other.user == user));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType, accessToken, refreshToken, tokenType, expiresIn, user);
|
||||
|
||||
/// Create a copy of LoginResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$LoginResponseImplCopyWith<_$LoginResponseImpl> get copyWith =>
|
||||
__$$LoginResponseImplCopyWithImpl<_$LoginResponseImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$LoginResponseImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _LoginResponse implements LoginResponse {
|
||||
const factory _LoginResponse(
|
||||
{@JsonKey(name: 'access_token') required final String accessToken,
|
||||
@JsonKey(name: 'refresh_token') required final String refreshToken,
|
||||
@JsonKey(name: 'token_type') required final String tokenType,
|
||||
@JsonKey(name: 'expires_in') required final int expiresIn,
|
||||
required final AuthUser user}) = _$LoginResponseImpl;
|
||||
|
||||
factory _LoginResponse.fromJson(Map<String, dynamic> json) =
|
||||
_$LoginResponseImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'access_token')
|
||||
String get accessToken;
|
||||
@override
|
||||
@JsonKey(name: 'refresh_token')
|
||||
String get refreshToken;
|
||||
@override
|
||||
@JsonKey(name: 'token_type')
|
||||
String get tokenType;
|
||||
@override
|
||||
@JsonKey(name: 'expires_in')
|
||||
int get expiresIn;
|
||||
@override
|
||||
AuthUser get user;
|
||||
|
||||
/// Create a copy of LoginResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$LoginResponseImplCopyWith<_$LoginResponseImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
Reference in New Issue
Block a user