-
-
Save marenovakovic/44f836aced9eebe32e3c78a71adb93d8 to your computer and use it in GitHub Desktop.
Simple data class in Dart, freezed fiel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
part of 'user.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#custom-getters-and-methods'); | |
/// @nodoc | |
mixin _$User { | |
@optionalTypeArgs | |
TResult when<TResult extends Object?>({ | |
required TResult Function(String id, String name, String phoneNumber) | |
authenticated, | |
required TResult Function() anonymous, | |
}) => | |
throw _privateConstructorUsedError; | |
@optionalTypeArgs | |
TResult? whenOrNull<TResult extends Object?>({ | |
TResult? Function(String id, String name, String phoneNumber)? | |
authenticated, | |
TResult? Function()? anonymous, | |
}) => | |
throw _privateConstructorUsedError; | |
@optionalTypeArgs | |
TResult maybeWhen<TResult extends Object?>({ | |
TResult Function(String id, String name, String phoneNumber)? authenticated, | |
TResult Function()? anonymous, | |
required TResult orElse(), | |
}) => | |
throw _privateConstructorUsedError; | |
@optionalTypeArgs | |
TResult map<TResult extends Object?>({ | |
required TResult Function(UserAuthenticated value) authenticated, | |
required TResult Function(UserAnonymous value) anonymous, | |
}) => | |
throw _privateConstructorUsedError; | |
@optionalTypeArgs | |
TResult? mapOrNull<TResult extends Object?>({ | |
TResult? Function(UserAuthenticated value)? authenticated, | |
TResult? Function(UserAnonymous value)? anonymous, | |
}) => | |
throw _privateConstructorUsedError; | |
@optionalTypeArgs | |
TResult maybeMap<TResult extends Object?>({ | |
TResult Function(UserAuthenticated value)? authenticated, | |
TResult Function(UserAnonymous value)? anonymous, | |
required TResult orElse(), | |
}) => | |
throw _privateConstructorUsedError; | |
} | |
/// @nodoc | |
abstract class $UserCopyWith<$Res> { | |
factory $UserCopyWith(User value, $Res Function(User) then) = | |
_$UserCopyWithImpl<$Res, User>; | |
} | |
/// @nodoc | |
class _$UserCopyWithImpl<$Res, $Val extends User> | |
implements $UserCopyWith<$Res> { | |
_$UserCopyWithImpl(this._value, this._then); | |
// ignore: unused_field | |
final $Val _value; | |
// ignore: unused_field | |
final $Res Function($Val) _then; | |
} | |
/// @nodoc | |
abstract class _$$UserAuthenticatedCopyWith<$Res> { | |
factory _$$UserAuthenticatedCopyWith( | |
_$UserAuthenticated value, $Res Function(_$UserAuthenticated) then) = | |
__$$UserAuthenticatedCopyWithImpl<$Res>; | |
@useResult | |
$Res call({String id, String name, String phoneNumber}); | |
} | |
/// @nodoc | |
class __$$UserAuthenticatedCopyWithImpl<$Res> | |
extends _$UserCopyWithImpl<$Res, _$UserAuthenticated> | |
implements _$$UserAuthenticatedCopyWith<$Res> { | |
__$$UserAuthenticatedCopyWithImpl( | |
_$UserAuthenticated _value, $Res Function(_$UserAuthenticated) _then) | |
: super(_value, _then); | |
@pragma('vm:prefer-inline') | |
@override | |
$Res call({ | |
Object? id = null, | |
Object? name = null, | |
Object? phoneNumber = null, | |
}) { | |
return _then(_$UserAuthenticated( | |
id: null == id | |
? _value.id | |
: id // ignore: cast_nullable_to_non_nullable | |
as String, | |
name: null == name | |
? _value.name | |
: name // ignore: cast_nullable_to_non_nullable | |
as String, | |
phoneNumber: null == phoneNumber | |
? _value.phoneNumber | |
: phoneNumber // ignore: cast_nullable_to_non_nullable | |
as String, | |
)); | |
} | |
} | |
/// @nodoc | |
class _$UserAuthenticated implements UserAuthenticated { | |
_$UserAuthenticated( | |
{required this.id, required this.name, required this.phoneNumber}); | |
@override | |
final String id; | |
@override | |
final String name; | |
@override | |
final String phoneNumber; | |
@override | |
String toString() { | |
return 'User.authenticated(id: $id, name: $name, phoneNumber: $phoneNumber)'; | |
} | |
@override | |
bool operator ==(dynamic other) { | |
return identical(this, other) || | |
(other.runtimeType == runtimeType && | |
other is _$UserAuthenticated && | |
(identical(other.id, id) || other.id == id) && | |
(identical(other.name, name) || other.name == name) && | |
(identical(other.phoneNumber, phoneNumber) || | |
other.phoneNumber == phoneNumber)); | |
} | |
@override | |
int get hashCode => Object.hash(runtimeType, id, name, phoneNumber); | |
@JsonKey(ignore: true) | |
@override | |
@pragma('vm:prefer-inline') | |
_$$UserAuthenticatedCopyWith<_$UserAuthenticated> get copyWith => | |
__$$UserAuthenticatedCopyWithImpl<_$UserAuthenticated>(this, _$identity); | |
@override | |
@optionalTypeArgs | |
TResult when<TResult extends Object?>({ | |
required TResult Function(String id, String name, String phoneNumber) | |
authenticated, | |
required TResult Function() anonymous, | |
}) { | |
return authenticated(id, name, phoneNumber); | |
} | |
@override | |
@optionalTypeArgs | |
TResult? whenOrNull<TResult extends Object?>({ | |
TResult? Function(String id, String name, String phoneNumber)? | |
authenticated, | |
TResult? Function()? anonymous, | |
}) { | |
return authenticated?.call(id, name, phoneNumber); | |
} | |
@override | |
@optionalTypeArgs | |
TResult maybeWhen<TResult extends Object?>({ | |
TResult Function(String id, String name, String phoneNumber)? authenticated, | |
TResult Function()? anonymous, | |
required TResult orElse(), | |
}) { | |
if (authenticated != null) { | |
return authenticated(id, name, phoneNumber); | |
} | |
return orElse(); | |
} | |
@override | |
@optionalTypeArgs | |
TResult map<TResult extends Object?>({ | |
required TResult Function(UserAuthenticated value) authenticated, | |
required TResult Function(UserAnonymous value) anonymous, | |
}) { | |
return authenticated(this); | |
} | |
@override | |
@optionalTypeArgs | |
TResult? mapOrNull<TResult extends Object?>({ | |
TResult? Function(UserAuthenticated value)? authenticated, | |
TResult? Function(UserAnonymous value)? anonymous, | |
}) { | |
return authenticated?.call(this); | |
} | |
@override | |
@optionalTypeArgs | |
TResult maybeMap<TResult extends Object?>({ | |
TResult Function(UserAuthenticated value)? authenticated, | |
TResult Function(UserAnonymous value)? anonymous, | |
required TResult orElse(), | |
}) { | |
if (authenticated != null) { | |
return authenticated(this); | |
} | |
return orElse(); | |
} | |
} | |
abstract class UserAuthenticated implements User { | |
factory UserAuthenticated( | |
{required final String id, | |
required final String name, | |
required final String phoneNumber}) = _$UserAuthenticated; | |
String get id; | |
String get name; | |
String get phoneNumber; | |
@JsonKey(ignore: true) | |
_$$UserAuthenticatedCopyWith<_$UserAuthenticated> get copyWith => | |
throw _privateConstructorUsedError; | |
} | |
/// @nodoc | |
abstract class _$$UserAnonymousCopyWith<$Res> { | |
factory _$$UserAnonymousCopyWith( | |
_$UserAnonymous value, $Res Function(_$UserAnonymous) then) = | |
__$$UserAnonymousCopyWithImpl<$Res>; | |
} | |
/// @nodoc | |
class __$$UserAnonymousCopyWithImpl<$Res> | |
extends _$UserCopyWithImpl<$Res, _$UserAnonymous> | |
implements _$$UserAnonymousCopyWith<$Res> { | |
__$$UserAnonymousCopyWithImpl( | |
_$UserAnonymous _value, $Res Function(_$UserAnonymous) _then) | |
: super(_value, _then); | |
} | |
/// @nodoc | |
class _$UserAnonymous implements UserAnonymous { | |
const _$UserAnonymous(); | |
@override | |
String toString() { | |
return 'User.anonymous()'; | |
} | |
@override | |
bool operator ==(dynamic other) { | |
return identical(this, other) || | |
(other.runtimeType == runtimeType && other is _$UserAnonymous); | |
} | |
@override | |
int get hashCode => runtimeType.hashCode; | |
@override | |
@optionalTypeArgs | |
TResult when<TResult extends Object?>({ | |
required TResult Function(String id, String name, String phoneNumber) | |
authenticated, | |
required TResult Function() anonymous, | |
}) { | |
return anonymous(); | |
} | |
@override | |
@optionalTypeArgs | |
TResult? whenOrNull<TResult extends Object?>({ | |
TResult? Function(String id, String name, String phoneNumber)? | |
authenticated, | |
TResult? Function()? anonymous, | |
}) { | |
return anonymous?.call(); | |
} | |
@override | |
@optionalTypeArgs | |
TResult maybeWhen<TResult extends Object?>({ | |
TResult Function(String id, String name, String phoneNumber)? authenticated, | |
TResult Function()? anonymous, | |
required TResult orElse(), | |
}) { | |
if (anonymous != null) { | |
return anonymous(); | |
} | |
return orElse(); | |
} | |
@override | |
@optionalTypeArgs | |
TResult map<TResult extends Object?>({ | |
required TResult Function(UserAuthenticated value) authenticated, | |
required TResult Function(UserAnonymous value) anonymous, | |
}) { | |
return anonymous(this); | |
} | |
@override | |
@optionalTypeArgs | |
TResult? mapOrNull<TResult extends Object?>({ | |
TResult? Function(UserAuthenticated value)? authenticated, | |
TResult? Function(UserAnonymous value)? anonymous, | |
}) { | |
return anonymous?.call(this); | |
} | |
@override | |
@optionalTypeArgs | |
TResult maybeMap<TResult extends Object?>({ | |
TResult Function(UserAuthenticated value)? authenticated, | |
TResult Function(UserAnonymous value)? anonymous, | |
required TResult orElse(), | |
}) { | |
if (anonymous != null) { | |
return anonymous(this); | |
} | |
return orElse(); | |
} | |
} | |
abstract class UserAnonymous implements User { | |
const factory UserAnonymous() = _$UserAnonymous; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment