barcode_scanner/lib/backend/schema/auth/auth_struct.freezed.dart
mandreshope b5e83e5b7f feat: Implements API-based user authentication
Replaces the mocked login flow with an actual API call to an authentication endpoint.

Updates the `AuthStruct` schema to align with the new API response, including fields for `accessToken`, `dbName`, `uid`, `name`, and `username`.

Introduces a `UserConnectedProvider` service for managing the storage and retrieval of authenticated user details, centralizing this logic and replacing prior direct local storage methods.

Integrates the new authentication process and user storage service into the login, reception, and profile pages for a unified experience.

Adjusts the splash screen duration to reflect the real-time nature of the authentication check.
2025-07-25 17:06:36 +03:00

159 lines
6.9 KiB
Dart

// dart format width=80
// 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 'auth_struct.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$AuthStruct {
@JsonKey(name: 'access_token') String? get accessToken;@JsonKey(name: 'db_name') String? get dbName; int? get uid; String? get refreshToken; String? get name; String? get username;
/// Create a copy of AuthStruct
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$AuthStructCopyWith<AuthStruct> get copyWith => _$AuthStructCopyWithImpl<AuthStruct>(this as AuthStruct, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AuthStruct&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.dbName, dbName) || other.dbName == dbName)&&(identical(other.uid, uid) || other.uid == uid)&&(identical(other.refreshToken, refreshToken) || other.refreshToken == refreshToken)&&(identical(other.name, name) || other.name == name)&&(identical(other.username, username) || other.username == username));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,accessToken,dbName,uid,refreshToken,name,username);
@override
String toString() {
return 'AuthStruct(accessToken: $accessToken, dbName: $dbName, uid: $uid, refreshToken: $refreshToken, name: $name, username: $username)';
}
}
/// @nodoc
abstract mixin class $AuthStructCopyWith<$Res> {
factory $AuthStructCopyWith(AuthStruct value, $Res Function(AuthStruct) _then) = _$AuthStructCopyWithImpl;
@useResult
$Res call({
@JsonKey(name: 'access_token') String? accessToken,@JsonKey(name: 'db_name') String? dbName, int? uid, String? refreshToken, String? name, String? username
});
}
/// @nodoc
class _$AuthStructCopyWithImpl<$Res>
implements $AuthStructCopyWith<$Res> {
_$AuthStructCopyWithImpl(this._self, this._then);
final AuthStruct _self;
final $Res Function(AuthStruct) _then;
/// Create a copy of AuthStruct
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? accessToken = freezed,Object? dbName = freezed,Object? uid = freezed,Object? refreshToken = freezed,Object? name = freezed,Object? username = freezed,}) {
return _then(_self.copyWith(
accessToken: freezed == accessToken ? _self.accessToken : accessToken // ignore: cast_nullable_to_non_nullable
as String?,dbName: freezed == dbName ? _self.dbName : dbName // ignore: cast_nullable_to_non_nullable
as String?,uid: freezed == uid ? _self.uid : uid // ignore: cast_nullable_to_non_nullable
as int?,refreshToken: freezed == refreshToken ? _self.refreshToken : refreshToken // ignore: cast_nullable_to_non_nullable
as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String?,username: freezed == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable(createToJson: false)
class _AuthStruct implements AuthStruct {
_AuthStruct({@JsonKey(name: 'access_token') this.accessToken, @JsonKey(name: 'db_name') this.dbName, this.uid, this.refreshToken, this.name, this.username});
factory _AuthStruct.fromJson(Map<String, dynamic> json) => _$AuthStructFromJson(json);
@override@JsonKey(name: 'access_token') final String? accessToken;
@override@JsonKey(name: 'db_name') final String? dbName;
@override final int? uid;
@override final String? refreshToken;
@override final String? name;
@override final String? username;
/// Create a copy of AuthStruct
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$AuthStructCopyWith<_AuthStruct> get copyWith => __$AuthStructCopyWithImpl<_AuthStruct>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AuthStruct&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.dbName, dbName) || other.dbName == dbName)&&(identical(other.uid, uid) || other.uid == uid)&&(identical(other.refreshToken, refreshToken) || other.refreshToken == refreshToken)&&(identical(other.name, name) || other.name == name)&&(identical(other.username, username) || other.username == username));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,accessToken,dbName,uid,refreshToken,name,username);
@override
String toString() {
return 'AuthStruct(accessToken: $accessToken, dbName: $dbName, uid: $uid, refreshToken: $refreshToken, name: $name, username: $username)';
}
}
/// @nodoc
abstract mixin class _$AuthStructCopyWith<$Res> implements $AuthStructCopyWith<$Res> {
factory _$AuthStructCopyWith(_AuthStruct value, $Res Function(_AuthStruct) _then) = __$AuthStructCopyWithImpl;
@override @useResult
$Res call({
@JsonKey(name: 'access_token') String? accessToken,@JsonKey(name: 'db_name') String? dbName, int? uid, String? refreshToken, String? name, String? username
});
}
/// @nodoc
class __$AuthStructCopyWithImpl<$Res>
implements _$AuthStructCopyWith<$Res> {
__$AuthStructCopyWithImpl(this._self, this._then);
final _AuthStruct _self;
final $Res Function(_AuthStruct) _then;
/// Create a copy of AuthStruct
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? accessToken = freezed,Object? dbName = freezed,Object? uid = freezed,Object? refreshToken = freezed,Object? name = freezed,Object? username = freezed,}) {
return _then(_AuthStruct(
accessToken: freezed == accessToken ? _self.accessToken : accessToken // ignore: cast_nullable_to_non_nullable
as String?,dbName: freezed == dbName ? _self.dbName : dbName // ignore: cast_nullable_to_non_nullable
as String?,uid: freezed == uid ? _self.uid : uid // ignore: cast_nullable_to_non_nullable
as int?,refreshToken: freezed == refreshToken ? _self.refreshToken : refreshToken // ignore: cast_nullable_to_non_nullable
as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String?,username: freezed == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on