added company profile and fixed some parts
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// ignore_for_file: invalid_annotation_target
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'company_profile_data.freezed.dart';
|
||||
part 'company_profile_data.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class CompanyProfileData with _$CompanyProfileData {
|
||||
const factory CompanyProfileData({
|
||||
required String? id,
|
||||
required String? name,
|
||||
@JsonKey(name: 'registration_number') required String? registrationNumber,
|
||||
required String? industry,
|
||||
@JsonKey(name: 'founded_year') required int? foundedYear,
|
||||
@JsonKey(name: 'created_at') required int? createdAt,
|
||||
}) = _CompanyProfileData;
|
||||
|
||||
factory CompanyProfileData.fromJson(Map<String, dynamic> json) =>
|
||||
_$CompanyProfileDataFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
// 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 'company_profile_data.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CompanyProfileData {
|
||||
|
||||
String? get id; String? get name;@JsonKey(name: 'registration_number') String? get registrationNumber; String? get industry;@JsonKey(name: 'founded_year') int? get foundedYear;@JsonKey(name: 'created_at') int? get createdAt;
|
||||
/// Create a copy of CompanyProfileData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$CompanyProfileDataCopyWith<CompanyProfileData> get copyWith => _$CompanyProfileDataCopyWithImpl<CompanyProfileData>(this as CompanyProfileData, _$identity);
|
||||
|
||||
/// Serializes this CompanyProfileData to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is CompanyProfileData&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.registrationNumber, registrationNumber) || other.registrationNumber == registrationNumber)&&(identical(other.industry, industry) || other.industry == industry)&&(identical(other.foundedYear, foundedYear) || other.foundedYear == foundedYear)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,registrationNumber,industry,foundedYear,createdAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CompanyProfileData(id: $id, name: $name, registrationNumber: $registrationNumber, industry: $industry, foundedYear: $foundedYear, createdAt: $createdAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $CompanyProfileDataCopyWith<$Res> {
|
||||
factory $CompanyProfileDataCopyWith(CompanyProfileData value, $Res Function(CompanyProfileData) _then) = _$CompanyProfileDataCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String? id, String? name,@JsonKey(name: 'registration_number') String? registrationNumber, String? industry,@JsonKey(name: 'founded_year') int? foundedYear,@JsonKey(name: 'created_at') int? createdAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$CompanyProfileDataCopyWithImpl<$Res>
|
||||
implements $CompanyProfileDataCopyWith<$Res> {
|
||||
_$CompanyProfileDataCopyWithImpl(this._self, this._then);
|
||||
|
||||
final CompanyProfileData _self;
|
||||
final $Res Function(CompanyProfileData) _then;
|
||||
|
||||
/// Create a copy of CompanyProfileData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? name = freezed,Object? registrationNumber = freezed,Object? industry = freezed,Object? foundedYear = freezed,Object? createdAt = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String?,registrationNumber: freezed == registrationNumber ? _self.registrationNumber : registrationNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String?,industry: freezed == industry ? _self.industry : industry // ignore: cast_nullable_to_non_nullable
|
||||
as String?,foundedYear: freezed == foundedYear ? _self.foundedYear : foundedYear // ignore: cast_nullable_to_non_nullable
|
||||
as int?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [CompanyProfileData].
|
||||
extension CompanyProfileDataPatterns on CompanyProfileData {
|
||||
/// 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( _CompanyProfileData value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CompanyProfileData() 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( _CompanyProfileData value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CompanyProfileData():
|
||||
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( _CompanyProfileData value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CompanyProfileData() 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? id, String? name, @JsonKey(name: 'registration_number') String? registrationNumber, String? industry, @JsonKey(name: 'founded_year') int? foundedYear, @JsonKey(name: 'created_at') int? createdAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CompanyProfileData() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.registrationNumber,_that.industry,_that.foundedYear,_that.createdAt);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? id, String? name, @JsonKey(name: 'registration_number') String? registrationNumber, String? industry, @JsonKey(name: 'founded_year') int? foundedYear, @JsonKey(name: 'created_at') int? createdAt) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CompanyProfileData():
|
||||
return $default(_that.id,_that.name,_that.registrationNumber,_that.industry,_that.foundedYear,_that.createdAt);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? id, String? name, @JsonKey(name: 'registration_number') String? registrationNumber, String? industry, @JsonKey(name: 'founded_year') int? foundedYear, @JsonKey(name: 'created_at') int? createdAt)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CompanyProfileData() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.registrationNumber,_that.industry,_that.foundedYear,_that.createdAt);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _CompanyProfileData implements CompanyProfileData {
|
||||
const _CompanyProfileData({required this.id, required this.name, @JsonKey(name: 'registration_number') required this.registrationNumber, required this.industry, @JsonKey(name: 'founded_year') required this.foundedYear, @JsonKey(name: 'created_at') required this.createdAt});
|
||||
factory _CompanyProfileData.fromJson(Map<String, dynamic> json) => _$CompanyProfileDataFromJson(json);
|
||||
|
||||
@override final String? id;
|
||||
@override final String? name;
|
||||
@override@JsonKey(name: 'registration_number') final String? registrationNumber;
|
||||
@override final String? industry;
|
||||
@override@JsonKey(name: 'founded_year') final int? foundedYear;
|
||||
@override@JsonKey(name: 'created_at') final int? createdAt;
|
||||
|
||||
/// Create a copy of CompanyProfileData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$CompanyProfileDataCopyWith<_CompanyProfileData> get copyWith => __$CompanyProfileDataCopyWithImpl<_CompanyProfileData>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$CompanyProfileDataToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _CompanyProfileData&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.registrationNumber, registrationNumber) || other.registrationNumber == registrationNumber)&&(identical(other.industry, industry) || other.industry == industry)&&(identical(other.foundedYear, foundedYear) || other.foundedYear == foundedYear)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,registrationNumber,industry,foundedYear,createdAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CompanyProfileData(id: $id, name: $name, registrationNumber: $registrationNumber, industry: $industry, foundedYear: $foundedYear, createdAt: $createdAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$CompanyProfileDataCopyWith<$Res> implements $CompanyProfileDataCopyWith<$Res> {
|
||||
factory _$CompanyProfileDataCopyWith(_CompanyProfileData value, $Res Function(_CompanyProfileData) _then) = __$CompanyProfileDataCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String? id, String? name,@JsonKey(name: 'registration_number') String? registrationNumber, String? industry,@JsonKey(name: 'founded_year') int? foundedYear,@JsonKey(name: 'created_at') int? createdAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$CompanyProfileDataCopyWithImpl<$Res>
|
||||
implements _$CompanyProfileDataCopyWith<$Res> {
|
||||
__$CompanyProfileDataCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _CompanyProfileData _self;
|
||||
final $Res Function(_CompanyProfileData) _then;
|
||||
|
||||
/// Create a copy of CompanyProfileData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = freezed,Object? name = freezed,Object? registrationNumber = freezed,Object? industry = freezed,Object? foundedYear = freezed,Object? createdAt = freezed,}) {
|
||||
return _then(_CompanyProfileData(
|
||||
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String?,registrationNumber: freezed == registrationNumber ? _self.registrationNumber : registrationNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String?,industry: freezed == industry ? _self.industry : industry // ignore: cast_nullable_to_non_nullable
|
||||
as String?,foundedYear: freezed == foundedYear ? _self.foundedYear : foundedYear // ignore: cast_nullable_to_non_nullable
|
||||
as int?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,27 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'company_profile_data.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_CompanyProfileData _$CompanyProfileDataFromJson(Map<String, dynamic> json) =>
|
||||
_CompanyProfileData(
|
||||
id: json['id'] as String?,
|
||||
name: json['name'] as String?,
|
||||
registrationNumber: json['registration_number'] as String?,
|
||||
industry: json['industry'] as String?,
|
||||
foundedYear: (json['founded_year'] as num?)?.toInt(),
|
||||
createdAt: (json['created_at'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CompanyProfileDataToJson(_CompanyProfileData instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'registration_number': instance.registrationNumber,
|
||||
'industry': instance.industry,
|
||||
'founded_year': instance.foundedYear,
|
||||
'created_at': instance.createdAt,
|
||||
};
|
||||
Reference in New Issue
Block a user