merge branches
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// ignore_for_file: invalid_annotation_target
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'contact_person.freezed.dart';
|
||||
part 'contact_person.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class ContactPerson with _$ContactPerson {
|
||||
const factory ContactPerson({
|
||||
@JsonKey(name: 'first_name') required String? firstName,
|
||||
@JsonKey(name: 'last_name') required String? lastName,
|
||||
@JsonKey(name: 'full_name') required String? fullName,
|
||||
required String? position,
|
||||
required String? email,
|
||||
required String? phone,
|
||||
required String? mobile,
|
||||
@JsonKey(name: 'is_primary') required bool? isPrimary,
|
||||
}) = _ContactPerson;
|
||||
|
||||
factory ContactPerson.fromJson(Map<String, Object?> json) =>
|
||||
_$ContactPersonFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// 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 'contact_person.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ContactPerson {
|
||||
|
||||
@JsonKey(name: 'first_name') String? get firstName;@JsonKey(name: 'last_name') String? get lastName;@JsonKey(name: 'full_name') String? get fullName; String? get position; String? get email; String? get phone; String? get mobile;@JsonKey(name: 'is_primary') bool? get isPrimary;
|
||||
/// Create a copy of ContactPerson
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$ContactPersonCopyWith<ContactPerson> get copyWith => _$ContactPersonCopyWithImpl<ContactPerson>(this as ContactPerson, _$identity);
|
||||
|
||||
/// Serializes this ContactPerson to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ContactPerson&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.fullName, fullName) || other.fullName == fullName)&&(identical(other.position, position) || other.position == position)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.isPrimary, isPrimary) || other.isPrimary == isPrimary));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,firstName,lastName,fullName,position,email,phone,mobile,isPrimary);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ContactPerson(firstName: $firstName, lastName: $lastName, fullName: $fullName, position: $position, email: $email, phone: $phone, mobile: $mobile, isPrimary: $isPrimary)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $ContactPersonCopyWith<$Res> {
|
||||
factory $ContactPersonCopyWith(ContactPerson value, $Res Function(ContactPerson) _then) = _$ContactPersonCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'first_name') String? firstName,@JsonKey(name: 'last_name') String? lastName,@JsonKey(name: 'full_name') String? fullName, String? position, String? email, String? phone, String? mobile,@JsonKey(name: 'is_primary') bool? isPrimary
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$ContactPersonCopyWithImpl<$Res>
|
||||
implements $ContactPersonCopyWith<$Res> {
|
||||
_$ContactPersonCopyWithImpl(this._self, this._then);
|
||||
|
||||
final ContactPerson _self;
|
||||
final $Res Function(ContactPerson) _then;
|
||||
|
||||
/// Create a copy of ContactPerson
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? firstName = freezed,Object? lastName = freezed,Object? fullName = freezed,Object? position = freezed,Object? email = freezed,Object? phone = freezed,Object? mobile = freezed,Object? isPrimary = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,fullName: freezed == fullName ? _self.fullName : fullName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,position: freezed == position ? _self.position : position // ignore: cast_nullable_to_non_nullable
|
||||
as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
|
||||
as String?,isPrimary: freezed == isPrimary ? _self.isPrimary : isPrimary // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [ContactPerson].
|
||||
extension ContactPersonPatterns on ContactPerson {
|
||||
/// 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( _ContactPerson value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ContactPerson() 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( _ContactPerson value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ContactPerson():
|
||||
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( _ContactPerson value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ContactPerson() 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(@JsonKey(name: 'first_name') String? firstName, @JsonKey(name: 'last_name') String? lastName, @JsonKey(name: 'full_name') String? fullName, String? position, String? email, String? phone, String? mobile, @JsonKey(name: 'is_primary') bool? isPrimary)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ContactPerson() when $default != null:
|
||||
return $default(_that.firstName,_that.lastName,_that.fullName,_that.position,_that.email,_that.phone,_that.mobile,_that.isPrimary);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(@JsonKey(name: 'first_name') String? firstName, @JsonKey(name: 'last_name') String? lastName, @JsonKey(name: 'full_name') String? fullName, String? position, String? email, String? phone, String? mobile, @JsonKey(name: 'is_primary') bool? isPrimary) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ContactPerson():
|
||||
return $default(_that.firstName,_that.lastName,_that.fullName,_that.position,_that.email,_that.phone,_that.mobile,_that.isPrimary);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(@JsonKey(name: 'first_name') String? firstName, @JsonKey(name: 'last_name') String? lastName, @JsonKey(name: 'full_name') String? fullName, String? position, String? email, String? phone, String? mobile, @JsonKey(name: 'is_primary') bool? isPrimary)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ContactPerson() when $default != null:
|
||||
return $default(_that.firstName,_that.lastName,_that.fullName,_that.position,_that.email,_that.phone,_that.mobile,_that.isPrimary);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _ContactPerson implements ContactPerson {
|
||||
const _ContactPerson({@JsonKey(name: 'first_name') required this.firstName, @JsonKey(name: 'last_name') required this.lastName, @JsonKey(name: 'full_name') required this.fullName, required this.position, required this.email, required this.phone, required this.mobile, @JsonKey(name: 'is_primary') required this.isPrimary});
|
||||
factory _ContactPerson.fromJson(Map<String, dynamic> json) => _$ContactPersonFromJson(json);
|
||||
|
||||
@override@JsonKey(name: 'first_name') final String? firstName;
|
||||
@override@JsonKey(name: 'last_name') final String? lastName;
|
||||
@override@JsonKey(name: 'full_name') final String? fullName;
|
||||
@override final String? position;
|
||||
@override final String? email;
|
||||
@override final String? phone;
|
||||
@override final String? mobile;
|
||||
@override@JsonKey(name: 'is_primary') final bool? isPrimary;
|
||||
|
||||
/// Create a copy of ContactPerson
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ContactPersonCopyWith<_ContactPerson> get copyWith => __$ContactPersonCopyWithImpl<_ContactPerson>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$ContactPersonToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ContactPerson&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.fullName, fullName) || other.fullName == fullName)&&(identical(other.position, position) || other.position == position)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.isPrimary, isPrimary) || other.isPrimary == isPrimary));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,firstName,lastName,fullName,position,email,phone,mobile,isPrimary);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ContactPerson(firstName: $firstName, lastName: $lastName, fullName: $fullName, position: $position, email: $email, phone: $phone, mobile: $mobile, isPrimary: $isPrimary)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ContactPersonCopyWith<$Res> implements $ContactPersonCopyWith<$Res> {
|
||||
factory _$ContactPersonCopyWith(_ContactPerson value, $Res Function(_ContactPerson) _then) = __$ContactPersonCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'first_name') String? firstName,@JsonKey(name: 'last_name') String? lastName,@JsonKey(name: 'full_name') String? fullName, String? position, String? email, String? phone, String? mobile,@JsonKey(name: 'is_primary') bool? isPrimary
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ContactPersonCopyWithImpl<$Res>
|
||||
implements _$ContactPersonCopyWith<$Res> {
|
||||
__$ContactPersonCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _ContactPerson _self;
|
||||
final $Res Function(_ContactPerson) _then;
|
||||
|
||||
/// Create a copy of ContactPerson
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? firstName = freezed,Object? lastName = freezed,Object? fullName = freezed,Object? position = freezed,Object? email = freezed,Object? phone = freezed,Object? mobile = freezed,Object? isPrimary = freezed,}) {
|
||||
return _then(_ContactPerson(
|
||||
firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,fullName: freezed == fullName ? _self.fullName : fullName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,position: freezed == position ? _self.position : position // ignore: cast_nullable_to_non_nullable
|
||||
as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
|
||||
as String?,isPrimary: freezed == isPrimary ? _self.isPrimary : isPrimary // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,31 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'contact_person.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_ContactPerson _$ContactPersonFromJson(Map<String, dynamic> json) =>
|
||||
_ContactPerson(
|
||||
firstName: json['first_name'] as String?,
|
||||
lastName: json['last_name'] as String?,
|
||||
fullName: json['full_name'] as String?,
|
||||
position: json['position'] as String?,
|
||||
email: json['email'] as String?,
|
||||
phone: json['phone'] as String?,
|
||||
mobile: json['mobile'] as String?,
|
||||
isPrimary: json['is_primary'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ContactPersonToJson(_ContactPerson instance) =>
|
||||
<String, dynamic>{
|
||||
'first_name': instance.firstName,
|
||||
'last_name': instance.lastName,
|
||||
'full_name': instance.fullName,
|
||||
'position': instance.position,
|
||||
'email': instance.email,
|
||||
'phone': instance.phone,
|
||||
'mobile': instance.mobile,
|
||||
'is_primary': instance.isPrimary,
|
||||
};
|
||||
Reference in New Issue
Block a user