mirror of
https://github.com/wger-project/flutter.git
synced 2026-11-29 09:20:56 +01:00
324 lines
14 KiB
Dart
324 lines
14 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
// coverage:ignore-file
|
|
// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package
|
|
// 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_state.dart';
|
|
|
|
// **************************************************************************
|
|
// FreezedGenerator
|
|
// **************************************************************************
|
|
|
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
// dart format off
|
|
T _$identity<T>(T value) => value;
|
|
/// @nodoc
|
|
mixin _$AuthState {
|
|
|
|
AuthStatus get status; JwtCredential? get credential; String? get serverUrl; String? get serverVersion; PackageInfo? get applicationVersion; bool get serverConfigWarning;/// True when the previous session ended involuntarily (expired or
|
|
/// revoked tokens). The login screen shows a hint so the user knows
|
|
/// why they have to log in again. Reset by the next login, which
|
|
/// builds a fresh state.
|
|
bool get sessionExpired;
|
|
/// Create a copy of AuthState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
@pragma('vm:prefer-inline')
|
|
$AuthStateCopyWith<AuthState> get copyWith => _$AuthStateCopyWithImpl<AuthState>(this as AuthState, _$identity);
|
|
|
|
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
final _this = this as AuthState;
|
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is AuthState&&(identical(other.status, _this.status) || other.status == _this.status)&&(identical(other.credential, _this.credential) || other.credential == _this.credential)&&(identical(other.serverUrl, _this.serverUrl) || other.serverUrl == _this.serverUrl)&&(identical(other.serverVersion, _this.serverVersion) || other.serverVersion == _this.serverVersion)&&(identical(other.applicationVersion, _this.applicationVersion) || other.applicationVersion == _this.applicationVersion)&&(identical(other.serverConfigWarning, _this.serverConfigWarning) || other.serverConfigWarning == _this.serverConfigWarning)&&(identical(other.sessionExpired, _this.sessionExpired) || other.sessionExpired == _this.sessionExpired));
|
|
}
|
|
|
|
|
|
@override
|
|
int get hashCode {
|
|
final _this = this as AuthState;
|
|
return Object.hash(runtimeType,_this.status,_this.credential,_this.serverUrl,_this.serverVersion,_this.applicationVersion,_this.serverConfigWarning,_this.sessionExpired);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
final _this = this as AuthState;
|
|
return 'AuthState(status: ${_this.status}, credential: ${_this.credential}, serverUrl: ${_this.serverUrl}, serverVersion: ${_this.serverVersion}, applicationVersion: ${_this.applicationVersion}, serverConfigWarning: ${_this.serverConfigWarning}, sessionExpired: ${_this.sessionExpired})';
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/// @nodoc
|
|
abstract mixin class $AuthStateCopyWith<$Res> {
|
|
factory $AuthStateCopyWith(AuthState value, $Res Function(AuthState) _then) = _$AuthStateCopyWithImpl;
|
|
@useResult
|
|
$Res call({
|
|
AuthStatus status, JwtCredential? credential, String? serverUrl, String? serverVersion, PackageInfo? applicationVersion, bool serverConfigWarning, bool sessionExpired
|
|
});
|
|
|
|
|
|
$JwtCredentialCopyWith<$Res>? get credential;
|
|
|
|
}
|
|
/// @nodoc
|
|
class _$AuthStateCopyWithImpl<$Res>
|
|
implements $AuthStateCopyWith<$Res> {
|
|
_$AuthStateCopyWithImpl(this._self, this._then);
|
|
|
|
final AuthState _self;
|
|
final $Res Function(AuthState) _then;
|
|
|
|
/// Create a copy of AuthState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@pragma('vm:prefer-inline') @override $Res call({Object? status = null,Object? credential = freezed,Object? serverUrl = freezed,Object? serverVersion = freezed,Object? applicationVersion = freezed,Object? serverConfigWarning = null,Object? sessionExpired = null,}) {
|
|
return _then(AuthState(
|
|
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
|
as AuthStatus,credential: freezed == credential ? _self.credential : credential // ignore: cast_nullable_to_non_nullable
|
|
as JwtCredential?,serverUrl: freezed == serverUrl ? _self.serverUrl : serverUrl // ignore: cast_nullable_to_non_nullable
|
|
as String?,serverVersion: freezed == serverVersion ? _self.serverVersion : serverVersion // ignore: cast_nullable_to_non_nullable
|
|
as String?,applicationVersion: freezed == applicationVersion ? _self.applicationVersion : applicationVersion // ignore: cast_nullable_to_non_nullable
|
|
as PackageInfo?,serverConfigWarning: null == serverConfigWarning ? _self.serverConfigWarning : serverConfigWarning // ignore: cast_nullable_to_non_nullable
|
|
as bool,sessionExpired: null == sessionExpired ? _self.sessionExpired : sessionExpired // ignore: cast_nullable_to_non_nullable
|
|
as bool,
|
|
));
|
|
}
|
|
/// Create a copy of AuthState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override
|
|
@pragma('vm:prefer-inline')
|
|
$JwtCredentialCopyWith<$Res>? get credential {
|
|
if (_self.credential == null) {
|
|
return null;
|
|
}
|
|
|
|
return $JwtCredentialCopyWith<$Res>(_self.credential!, (value) {
|
|
return _then(_self.copyWith(credential: value));
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
/// Adds pattern-matching-related methods to [AuthState].
|
|
extension AuthStatePatterns on AuthState {
|
|
/// A variant of `map` that fallback to returning `orElse`.
|
|
///
|
|
/// It is equivalent to doing:
|
|
/// ```dart
|
|
/// switch (sealedClass) {
|
|
/// case final Subclass value:
|
|
/// return ...;
|
|
/// case _:
|
|
/// return orElse();
|
|
/// }
|
|
/// ```
|
|
|
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _AuthState value)? $default,{required TResult orElse(),}){
|
|
final _that = this;
|
|
switch (_that) {
|
|
case _AuthState() when $default != null:
|
|
return $default(_that);case _:
|
|
return orElse();
|
|
|
|
}
|
|
}
|
|
/// A `switch`-like method, using callbacks.
|
|
///
|
|
/// Callbacks receives the raw object, upcasted.
|
|
/// It is equivalent to doing:
|
|
/// ```dart
|
|
/// switch (sealedClass) {
|
|
/// case final Subclass value:
|
|
/// return ...;
|
|
/// case final Subclass2 value:
|
|
/// return ...;
|
|
/// }
|
|
/// ```
|
|
|
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _AuthState value) $default,){
|
|
final _that = this;
|
|
switch (_that) {
|
|
case _AuthState():
|
|
return $default(_that);}
|
|
}
|
|
/// A variant of `map` that fallback to returning `null`.
|
|
///
|
|
/// It is equivalent to doing:
|
|
/// ```dart
|
|
/// switch (sealedClass) {
|
|
/// case final Subclass value:
|
|
/// return ...;
|
|
/// case _:
|
|
/// return null;
|
|
/// }
|
|
/// ```
|
|
|
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _AuthState value)? $default,){
|
|
final _that = this;
|
|
switch (_that) {
|
|
case _AuthState() when $default != null:
|
|
return $default(_that);case _:
|
|
return null;
|
|
|
|
}
|
|
}
|
|
/// A variant of `when` that fallback to an `orElse` callback.
|
|
///
|
|
/// It is equivalent to doing:
|
|
/// ```dart
|
|
/// switch (sealedClass) {
|
|
/// case Subclass(:final field):
|
|
/// return ...;
|
|
/// case _:
|
|
/// return orElse();
|
|
/// }
|
|
/// ```
|
|
|
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( AuthStatus status, JwtCredential? credential, String? serverUrl, String? serverVersion, PackageInfo? applicationVersion, bool serverConfigWarning, bool sessionExpired)? $default,{required TResult orElse(),}) {final _that = this;
|
|
switch (_that) {
|
|
case _AuthState() when $default != null:
|
|
return $default(_that.status,_that.credential,_that.serverUrl,_that.serverVersion,_that.applicationVersion,_that.serverConfigWarning,_that.sessionExpired);case _:
|
|
return orElse();
|
|
|
|
}
|
|
}
|
|
/// A `switch`-like method, using callbacks.
|
|
///
|
|
/// As opposed to `map`, this offers destructuring.
|
|
/// It is equivalent to doing:
|
|
/// ```dart
|
|
/// switch (sealedClass) {
|
|
/// case Subclass(:final field):
|
|
/// return ...;
|
|
/// case Subclass2(:final field2):
|
|
/// return ...;
|
|
/// }
|
|
/// ```
|
|
|
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( AuthStatus status, JwtCredential? credential, String? serverUrl, String? serverVersion, PackageInfo? applicationVersion, bool serverConfigWarning, bool sessionExpired) $default,) {final _that = this;
|
|
switch (_that) {
|
|
case _AuthState():
|
|
return $default(_that.status,_that.credential,_that.serverUrl,_that.serverVersion,_that.applicationVersion,_that.serverConfigWarning,_that.sessionExpired);}
|
|
}
|
|
/// A variant of `when` that fallback to returning `null`
|
|
///
|
|
/// It is equivalent to doing:
|
|
/// ```dart
|
|
/// switch (sealedClass) {
|
|
/// case Subclass(:final field):
|
|
/// return ...;
|
|
/// case _:
|
|
/// return null;
|
|
/// }
|
|
/// ```
|
|
|
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( AuthStatus status, JwtCredential? credential, String? serverUrl, String? serverVersion, PackageInfo? applicationVersion, bool serverConfigWarning, bool sessionExpired)? $default,) {final _that = this;
|
|
switch (_that) {
|
|
case _AuthState() when $default != null:
|
|
return $default(_that.status,_that.credential,_that.serverUrl,_that.serverVersion,_that.applicationVersion,_that.serverConfigWarning,_that.sessionExpired);case _:
|
|
return null;
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
/// @nodoc
|
|
|
|
|
|
class _AuthState extends AuthState {
|
|
const _AuthState({this.status = AuthStatus.loggedOut, this.credential, this.serverUrl, this.serverVersion, this.applicationVersion, this.serverConfigWarning = false, this.sessionExpired = false}): super._();
|
|
|
|
|
|
@override@JsonKey() final AuthStatus status;
|
|
@override final JwtCredential? credential;
|
|
@override final String? serverUrl;
|
|
@override final String? serverVersion;
|
|
@override final PackageInfo? applicationVersion;
|
|
@override@JsonKey() final bool serverConfigWarning;
|
|
/// True when the previous session ended involuntarily (expired or
|
|
/// revoked tokens). The login screen shows a hint so the user knows
|
|
/// why they have to log in again. Reset by the next login, which
|
|
/// builds a fresh state.
|
|
@override@JsonKey() final bool sessionExpired;
|
|
|
|
/// Create a copy of AuthState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
|
@pragma('vm:prefer-inline')
|
|
_$AuthStateCopyWith<_AuthState> get copyWith => __$AuthStateCopyWithImpl<_AuthState>(this, _$identity);
|
|
|
|
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AuthState&&(identical(other.status, status) || other.status == status)&&(identical(other.credential, credential) || other.credential == credential)&&(identical(other.serverUrl, serverUrl) || other.serverUrl == serverUrl)&&(identical(other.serverVersion, serverVersion) || other.serverVersion == serverVersion)&&(identical(other.applicationVersion, applicationVersion) || other.applicationVersion == applicationVersion)&&(identical(other.serverConfigWarning, serverConfigWarning) || other.serverConfigWarning == serverConfigWarning)&&(identical(other.sessionExpired, sessionExpired) || other.sessionExpired == sessionExpired));
|
|
}
|
|
|
|
|
|
@override
|
|
int get hashCode {
|
|
return Object.hash(runtimeType,status,credential,serverUrl,serverVersion,applicationVersion,serverConfigWarning,sessionExpired);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return 'AuthState(status: $status, credential: $credential, serverUrl: $serverUrl, serverVersion: $serverVersion, applicationVersion: $applicationVersion, serverConfigWarning: $serverConfigWarning, sessionExpired: $sessionExpired)';
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/// @nodoc
|
|
abstract mixin class _$AuthStateCopyWith<$Res> implements $AuthStateCopyWith<$Res> {
|
|
factory _$AuthStateCopyWith(_AuthState value, $Res Function(_AuthState) _then) = __$AuthStateCopyWithImpl;
|
|
@override @useResult
|
|
$Res call({
|
|
AuthStatus status, JwtCredential? credential, String? serverUrl, String? serverVersion, PackageInfo? applicationVersion, bool serverConfigWarning, bool sessionExpired
|
|
});
|
|
|
|
|
|
@override $JwtCredentialCopyWith<$Res>? get credential;
|
|
|
|
}
|
|
/// @nodoc
|
|
class __$AuthStateCopyWithImpl<$Res>
|
|
implements _$AuthStateCopyWith<$Res> {
|
|
__$AuthStateCopyWithImpl(this._self, this._then);
|
|
|
|
final _AuthState _self;
|
|
final $Res Function(_AuthState) _then;
|
|
|
|
/// Create a copy of AuthState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override @pragma('vm:prefer-inline') $Res call({Object? status = null,Object? credential = freezed,Object? serverUrl = freezed,Object? serverVersion = freezed,Object? applicationVersion = freezed,Object? serverConfigWarning = null,Object? sessionExpired = null,}) {
|
|
return _then(_AuthState(
|
|
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
|
as AuthStatus,credential: freezed == credential ? _self.credential : credential // ignore: cast_nullable_to_non_nullable
|
|
as JwtCredential?,serverUrl: freezed == serverUrl ? _self.serverUrl : serverUrl // ignore: cast_nullable_to_non_nullable
|
|
as String?,serverVersion: freezed == serverVersion ? _self.serverVersion : serverVersion // ignore: cast_nullable_to_non_nullable
|
|
as String?,applicationVersion: freezed == applicationVersion ? _self.applicationVersion : applicationVersion // ignore: cast_nullable_to_non_nullable
|
|
as PackageInfo?,serverConfigWarning: null == serverConfigWarning ? _self.serverConfigWarning : serverConfigWarning // ignore: cast_nullable_to_non_nullable
|
|
as bool,sessionExpired: null == sessionExpired ? _self.sessionExpired : sessionExpired // ignore: cast_nullable_to_non_nullable
|
|
as bool,
|
|
));
|
|
}
|
|
|
|
/// Create a copy of AuthState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override
|
|
@pragma('vm:prefer-inline')
|
|
$JwtCredentialCopyWith<$Res>? get credential {
|
|
if (_self.credential == null) {
|
|
return null;
|
|
}
|
|
|
|
return $JwtCredentialCopyWith<$Res>(_self.credential!, (value) {
|
|
return _then(_self.copyWith(credential: value));
|
|
});
|
|
}
|
|
}
|
|
|
|
// dart format on
|