Fixed-wording tests for the generic credentials error, redacted toString for login/register state, shared AuthFailure.isRetryable, autofill context finished even when the router removes the screen, stricter from validation (encoded and control-character variants), more widget tests. Refs #1 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
331 lines
14 KiB
Dart
331 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 'login_state.dart';
|
|
|
|
// **************************************************************************
|
|
// FreezedGenerator
|
|
// **************************************************************************
|
|
|
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
// dart format off
|
|
T _$identity<T>(T value) => value;
|
|
/// @nodoc
|
|
mixin _$LoginState {
|
|
|
|
String get email; String get password; Set<LoginField> get visibleFields; LoginStatus get status;/// Failure of the last attempt, shown as banner.
|
|
AuthFailure? get bannerFailure;/// Address of the last attempt that ended in `emailNotConfirmed`. The
|
|
/// resend action uses this one, not whatever is in the field now.
|
|
String? get unconfirmedEmail;/// Field that should receive focus after a failed submit.
|
|
LoginField? get focusField;/// Incremented whenever [focusField] is set.
|
|
int get focusRequest;
|
|
/// Create a copy of LoginState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
@pragma('vm:prefer-inline')
|
|
$LoginStateCopyWith<LoginState> get copyWith => _$LoginStateCopyWithImpl<LoginState>(this as LoginState, _$identity);
|
|
|
|
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
final _this = this as LoginState;
|
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is LoginState&&(identical(other.email, _this.email) || other.email == _this.email)&&(identical(other.password, _this.password) || other.password == _this.password)&&const DeepCollectionEquality().equals(other.visibleFields, _this.visibleFields)&&(identical(other.status, _this.status) || other.status == _this.status)&&(identical(other.bannerFailure, _this.bannerFailure) || other.bannerFailure == _this.bannerFailure)&&(identical(other.unconfirmedEmail, _this.unconfirmedEmail) || other.unconfirmedEmail == _this.unconfirmedEmail)&&(identical(other.focusField, _this.focusField) || other.focusField == _this.focusField)&&(identical(other.focusRequest, _this.focusRequest) || other.focusRequest == _this.focusRequest));
|
|
}
|
|
|
|
|
|
@override
|
|
int get hashCode {
|
|
final _this = this as LoginState;
|
|
return Object.hash(runtimeType,_this.email,_this.password,const DeepCollectionEquality().hash(_this.visibleFields),_this.status,_this.bannerFailure,_this.unconfirmedEmail,_this.focusField,_this.focusRequest);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/// @nodoc
|
|
abstract mixin class $LoginStateCopyWith<$Res> {
|
|
factory $LoginStateCopyWith(LoginState value, $Res Function(LoginState) _then) = _$LoginStateCopyWithImpl;
|
|
@useResult
|
|
$Res call({
|
|
String email, String password, Set<LoginField> visibleFields, LoginStatus status, AuthFailure? bannerFailure, String? unconfirmedEmail, LoginField? focusField, int focusRequest
|
|
});
|
|
|
|
|
|
$AuthFailureCopyWith<$Res>? get bannerFailure;
|
|
|
|
}
|
|
/// @nodoc
|
|
class _$LoginStateCopyWithImpl<$Res>
|
|
implements $LoginStateCopyWith<$Res> {
|
|
_$LoginStateCopyWithImpl(this._self, this._then);
|
|
|
|
final LoginState _self;
|
|
final $Res Function(LoginState) _then;
|
|
|
|
/// Create a copy of LoginState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@pragma('vm:prefer-inline') @override $Res call({Object? email = null,Object? password = null,Object? visibleFields = null,Object? status = null,Object? bannerFailure = freezed,Object? unconfirmedEmail = freezed,Object? focusField = freezed,Object? focusRequest = null,}) {
|
|
return _then(LoginState(
|
|
email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
|
as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
|
|
as String,visibleFields: null == visibleFields ? _self.visibleFields : visibleFields // ignore: cast_nullable_to_non_nullable
|
|
as Set<LoginField>,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
|
as LoginStatus,bannerFailure: freezed == bannerFailure ? _self.bannerFailure : bannerFailure // ignore: cast_nullable_to_non_nullable
|
|
as AuthFailure?,unconfirmedEmail: freezed == unconfirmedEmail ? _self.unconfirmedEmail : unconfirmedEmail // ignore: cast_nullable_to_non_nullable
|
|
as String?,focusField: freezed == focusField ? _self.focusField : focusField // ignore: cast_nullable_to_non_nullable
|
|
as LoginField?,focusRequest: null == focusRequest ? _self.focusRequest : focusRequest // ignore: cast_nullable_to_non_nullable
|
|
as int,
|
|
));
|
|
}
|
|
/// Create a copy of LoginState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override
|
|
@pragma('vm:prefer-inline')
|
|
$AuthFailureCopyWith<$Res>? get bannerFailure {
|
|
if (_self.bannerFailure == null) {
|
|
return null;
|
|
}
|
|
|
|
return $AuthFailureCopyWith<$Res>(_self.bannerFailure!, (value) {
|
|
return _then(_self.copyWith(bannerFailure: value));
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
/// Adds pattern-matching-related methods to [LoginState].
|
|
extension LoginStatePatterns on LoginState {
|
|
/// 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( _LoginState value)? $default,{required TResult orElse(),}){
|
|
final _that = this;
|
|
switch (_that) {
|
|
case _LoginState() 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( _LoginState value) $default,){
|
|
final _that = this;
|
|
switch (_that) {
|
|
case _LoginState():
|
|
return $default(_that);case _:
|
|
throw StateError('Unexpected subclass');
|
|
|
|
}
|
|
}
|
|
/// A variant of `map` that fallback to returning `null`.
|
|
///
|
|
/// It is equivalent to doing:
|
|
/// ```dart
|
|
/// switch (sealedClass) {
|
|
/// case final Subclass value:
|
|
/// return ...;
|
|
/// case _:
|
|
/// return null;
|
|
/// }
|
|
/// ```
|
|
|
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _LoginState value)? $default,){
|
|
final _that = this;
|
|
switch (_that) {
|
|
case _LoginState() when $default != null:
|
|
return $default(_that);case _:
|
|
return null;
|
|
|
|
}
|
|
}
|
|
/// A variant of `when` that fallback to an `orElse` callback.
|
|
///
|
|
/// It is equivalent to doing:
|
|
/// ```dart
|
|
/// switch (sealedClass) {
|
|
/// case Subclass(:final field):
|
|
/// return ...;
|
|
/// case _:
|
|
/// return orElse();
|
|
/// }
|
|
/// ```
|
|
|
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String email, String password, Set<LoginField> visibleFields, LoginStatus status, AuthFailure? bannerFailure, String? unconfirmedEmail, LoginField? focusField, int focusRequest)? $default,{required TResult orElse(),}) {final _that = this;
|
|
switch (_that) {
|
|
case _LoginState() when $default != null:
|
|
return $default(_that.email,_that.password,_that.visibleFields,_that.status,_that.bannerFailure,_that.unconfirmedEmail,_that.focusField,_that.focusRequest);case _:
|
|
return orElse();
|
|
|
|
}
|
|
}
|
|
/// A `switch`-like method, using callbacks.
|
|
///
|
|
/// As opposed to `map`, this offers destructuring.
|
|
/// It is equivalent to doing:
|
|
/// ```dart
|
|
/// switch (sealedClass) {
|
|
/// case Subclass(:final field):
|
|
/// return ...;
|
|
/// case Subclass2(:final field2):
|
|
/// return ...;
|
|
/// }
|
|
/// ```
|
|
|
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String email, String password, Set<LoginField> visibleFields, LoginStatus status, AuthFailure? bannerFailure, String? unconfirmedEmail, LoginField? focusField, int focusRequest) $default,) {final _that = this;
|
|
switch (_that) {
|
|
case _LoginState():
|
|
return $default(_that.email,_that.password,_that.visibleFields,_that.status,_that.bannerFailure,_that.unconfirmedEmail,_that.focusField,_that.focusRequest);case _:
|
|
throw StateError('Unexpected subclass');
|
|
|
|
}
|
|
}
|
|
/// A variant of `when` that fallback to returning `null`
|
|
///
|
|
/// It is equivalent to doing:
|
|
/// ```dart
|
|
/// switch (sealedClass) {
|
|
/// case Subclass(:final field):
|
|
/// return ...;
|
|
/// case _:
|
|
/// return null;
|
|
/// }
|
|
/// ```
|
|
|
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String email, String password, Set<LoginField> visibleFields, LoginStatus status, AuthFailure? bannerFailure, String? unconfirmedEmail, LoginField? focusField, int focusRequest)? $default,) {final _that = this;
|
|
switch (_that) {
|
|
case _LoginState() when $default != null:
|
|
return $default(_that.email,_that.password,_that.visibleFields,_that.status,_that.bannerFailure,_that.unconfirmedEmail,_that.focusField,_that.focusRequest);case _:
|
|
return null;
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
/// @nodoc
|
|
|
|
|
|
class _LoginState extends LoginState {
|
|
const _LoginState({this.email = '', this.password = '', Set<LoginField> visibleFields = const <LoginField>{}, this.status = LoginStatus.editing, this.bannerFailure, this.unconfirmedEmail, this.focusField, this.focusRequest = 0}): _visibleFields = visibleFields,super._();
|
|
|
|
|
|
@override@JsonKey() final String email;
|
|
@override@JsonKey() final String password;
|
|
final Set<LoginField> _visibleFields;
|
|
@override@JsonKey() Set<LoginField> get visibleFields {
|
|
if (_visibleFields is EqualUnmodifiableSetView) return _visibleFields;
|
|
// ignore: implicit_dynamic_type
|
|
return EqualUnmodifiableSetView(_visibleFields);
|
|
}
|
|
|
|
@override@JsonKey() final LoginStatus status;
|
|
/// Failure of the last attempt, shown as banner.
|
|
@override final AuthFailure? bannerFailure;
|
|
/// Address of the last attempt that ended in `emailNotConfirmed`. The
|
|
/// resend action uses this one, not whatever is in the field now.
|
|
@override final String? unconfirmedEmail;
|
|
/// Field that should receive focus after a failed submit.
|
|
@override final LoginField? focusField;
|
|
/// Incremented whenever [focusField] is set.
|
|
@override@JsonKey() final int focusRequest;
|
|
|
|
/// Create a copy of LoginState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
|
@pragma('vm:prefer-inline')
|
|
_$LoginStateCopyWith<_LoginState> get copyWith => __$LoginStateCopyWithImpl<_LoginState>(this, _$identity);
|
|
|
|
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LoginState&&(identical(other.email, email) || other.email == email)&&(identical(other.password, password) || other.password == password)&&const DeepCollectionEquality().equals(other.visibleFields, _visibleFields)&&(identical(other.status, status) || other.status == status)&&(identical(other.bannerFailure, bannerFailure) || other.bannerFailure == bannerFailure)&&(identical(other.unconfirmedEmail, unconfirmedEmail) || other.unconfirmedEmail == unconfirmedEmail)&&(identical(other.focusField, focusField) || other.focusField == focusField)&&(identical(other.focusRequest, focusRequest) || other.focusRequest == focusRequest));
|
|
}
|
|
|
|
|
|
@override
|
|
int get hashCode {
|
|
return Object.hash(runtimeType,email,password,const DeepCollectionEquality().hash(_visibleFields),status,bannerFailure,unconfirmedEmail,focusField,focusRequest);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/// @nodoc
|
|
abstract mixin class _$LoginStateCopyWith<$Res> implements $LoginStateCopyWith<$Res> {
|
|
factory _$LoginStateCopyWith(_LoginState value, $Res Function(_LoginState) _then) = __$LoginStateCopyWithImpl;
|
|
@override @useResult
|
|
$Res call({
|
|
String email, String password, Set<LoginField> visibleFields, LoginStatus status, AuthFailure? bannerFailure, String? unconfirmedEmail, LoginField? focusField, int focusRequest
|
|
});
|
|
|
|
|
|
@override $AuthFailureCopyWith<$Res>? get bannerFailure;
|
|
|
|
}
|
|
/// @nodoc
|
|
class __$LoginStateCopyWithImpl<$Res>
|
|
implements _$LoginStateCopyWith<$Res> {
|
|
__$LoginStateCopyWithImpl(this._self, this._then);
|
|
|
|
final _LoginState _self;
|
|
final $Res Function(_LoginState) _then;
|
|
|
|
/// Create a copy of LoginState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override @pragma('vm:prefer-inline') $Res call({Object? email = null,Object? password = null,Object? visibleFields = null,Object? status = null,Object? bannerFailure = freezed,Object? unconfirmedEmail = freezed,Object? focusField = freezed,Object? focusRequest = null,}) {
|
|
return _then(_LoginState(
|
|
email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
|
as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
|
|
as String,visibleFields: null == visibleFields ? _self._visibleFields : visibleFields // ignore: cast_nullable_to_non_nullable
|
|
as Set<LoginField>,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
|
as LoginStatus,bannerFailure: freezed == bannerFailure ? _self.bannerFailure : bannerFailure // ignore: cast_nullable_to_non_nullable
|
|
as AuthFailure?,unconfirmedEmail: freezed == unconfirmedEmail ? _self.unconfirmedEmail : unconfirmedEmail // ignore: cast_nullable_to_non_nullable
|
|
as String?,focusField: freezed == focusField ? _self.focusField : focusField // ignore: cast_nullable_to_non_nullable
|
|
as LoginField?,focusRequest: null == focusRequest ? _self.focusRequest : focusRequest // ignore: cast_nullable_to_non_nullable
|
|
as int,
|
|
));
|
|
}
|
|
|
|
/// Create a copy of LoginState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override
|
|
@pragma('vm:prefer-inline')
|
|
$AuthFailureCopyWith<$Res>? get bannerFailure {
|
|
if (_self.bannerFailure == null) {
|
|
return null;
|
|
}
|
|
|
|
return $AuthFailureCopyWith<$Res>(_self.bannerFailure!, (value) {
|
|
return _then(_self.copyWith(bannerFailure: value));
|
|
});
|
|
}
|
|
}
|
|
|
|
// dart format on
|