I have the _privateConstructorUsedError error what should i do? #979
Unanswered
MohammedJamal21
asked this question in
Q&A
Replies: 1 comment 3 replies
-
What does that mean exactly? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello guys,
I get the _privateConstructorUsedError error in my generated (freezed) file.
This is my code:
import 'package:formz/formz.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import '../../domain/entities/forms/email_input.dart';
import '../../domain/entities/forms/password_input.dart';
part 'auth_input_validation_state.freezed.dart';
@freezed
class AuthInputValidationState with _$AuthInputValidationState {
const factory AuthInputValidationState({
@default(EmailInput.pure()) EmailInput email,
@default(PasswordInput.pure()) PasswordInput password,
@default(FormzSubmissionStatus.initial) FormzSubmissionStatus status,
}) = _AuthInputValidationState;
factory AuthInputValidationState.fromJson(Map<String, Object?> json) =>
_$AuthInputValidationStateFromJson(json);
}
And this is the generated file:
// 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_input_validation_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity(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#custom-getters-and-methods');AuthInputValidationState _$AuthInputValidationStateFromJson(
Map<String, dynamic> json) {
return _AuthInputValidationState.fromJson(json);
}
/// @Nodoc
mixin _$AuthInputValidationState {
EmailInput get email => throw _privateConstructorUsedError;
PasswordInput get password => throw _privateConstructorUsedError;
FormzSubmissionStatus get status => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@jsonkey(ignore: true)
$AuthInputValidationStateCopyWith get copyWith =>
throw _privateConstructorUsedError;
}
/// @Nodoc
abstract class $AuthInputValidationStateCopyWith<$Res> {
factory $AuthInputValidationStateCopyWith(AuthInputValidationState value,
$Res Function(AuthInputValidationState) then) =
_$AuthInputValidationStateCopyWithImpl<$Res, AuthInputValidationState>;
@useResult
$Res call(
{EmailInput email, PasswordInput password, FormzSubmissionStatus status});
}
/// @Nodoc
class _$AuthInputValidationStateCopyWithImpl<$Res,
$Val extends AuthInputValidationState>
implements $AuthInputValidationStateCopyWith<$Res> {
_$AuthInputValidationStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@OverRide
$Res call({
Object? email = null,
Object? password = null,
Object? status = null,
}) {
return _then(_value.copyWith(
email: null == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as EmailInput,
password: null == password
? _value.password
: password // ignore: cast_nullable_to_non_nullable
as PasswordInput,
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as FormzSubmissionStatus,
) as $Val);
}
}
/// @Nodoc
abstract class _$$_AuthInputValidationStateCopyWith<$Res>
implements $AuthInputValidationStateCopyWith<$Res> {
factory _$$_AuthInputValidationStateCopyWith(
_$AuthInputValidationState value,
$Res Function($_AuthInputValidationState) then) =
__$$_AuthInputValidationStateCopyWithImpl<$Res>;
@OverRide
@useResult
$Res call(
{EmailInput email, PasswordInput password, FormzSubmissionStatus status});
}
/// @Nodoc
class __$$_AuthInputValidationStateCopyWithImpl<$Res>
extends _$AuthInputValidationStateCopyWithImpl<$Res,
_$_AuthInputValidationState>
implements _$$_AuthInputValidationStateCopyWith<$Res> {
__$$AuthInputValidationStateCopyWithImpl($_AuthInputValidationState value,
$Res Function($_AuthInputValidationState) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@OverRide
$Res call({
Object? email = null,
Object? password = null,
Object? status = null,
}) {
return then($_AuthInputValidationState(
email: null == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as EmailInput,
password: null == password
? _value.password
: password // ignore: cast_nullable_to_non_nullable
as PasswordInput,
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as FormzSubmissionStatus,
));
}
}
/// @Nodoc
@JsonSerializable()
class _$_AuthInputValidationState implements _AuthInputValidationState {
const _$_AuthInputValidationState(
{this.email = const EmailInput.pure(),
this.password = const PasswordInput.pure(),
this.status = FormzSubmissionStatus.initial});
factory _$_AuthInputValidationState.fromJson(Map<String, dynamic> json) =>
_$$_AuthInputValidationStateFromJson(json);
@OverRide
@jsonkey()
final EmailInput email;
@OverRide
@jsonkey()
final PasswordInput password;
@OverRide
@jsonkey()
final FormzSubmissionStatus status;
@OverRide
String toString() {
return 'AuthInputValidationState(email: $email, password: $password, status: $status)';
}
@OverRide
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$_AuthInputValidationState &&
(identical(other.email, email) || other.email == email) &&
(identical(other.password, password) ||
other.password == password) &&
(identical(other.status, status) || other.status == status));
}
@jsonkey(ignore: true)
@OverRide
int get hashCode => Object.hash(runtimeType, email, password, status);
@jsonkey(ignore: true)
@OverRide
@pragma('vm:prefer-inline')
_$$AuthInputValidationStateCopyWith<$_AuthInputValidationState>
get copyWith => __$$_AuthInputValidationStateCopyWithImpl<
_$_AuthInputValidationState>(this, _$identity);
@OverRide
Map<String, dynamic> toJson() {
return _$$_AuthInputValidationStateToJson(
this,
);
}
}
abstract class _AuthInputValidationState implements AuthInputValidationState {
const factory _AuthInputValidationState(
{final EmailInput email,
final PasswordInput password,
final FormzSubmissionStatus status}) = _$_AuthInputValidationState;
factory _AuthInputValidationState.fromJson(Map<String, dynamic> json) =
_$_AuthInputValidationState.fromJson;
@OverRide
EmailInput get email;
@OverRide
PasswordInput get password;
@OverRide
FormzSubmissionStatus get status;
@OverRide
@jsonkey(ignore: true)
_$$AuthInputValidationStateCopyWith<$_AuthInputValidationState>
get copyWith => throw _privateConstructorUsedError;
}
Beta Was this translation helpful? Give feedback.
All reactions