fix: fix analyzer

This commit is contained in:
mso7nueh
2024-11-20 11:15:20 +03:00
parent f230833c4e
commit 1ac956b448
10 changed files with 472 additions and 5 deletions

View File

@@ -0,0 +1,21 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'product_moderation_model.freezed.dart';
part 'product_moderation_model.g.dart';
@freezed
class ProductModerationModel with _$ProductModerationModel {
const factory ProductModerationModel({
required String name,
@JsonKey(name: 'energy_on_100gr')
required int energy,
@JsonKey(name: 'proteins_on_100gr')
required int proteins,
@JsonKey(name: 'fats_on_100gr')
required int fats,
@JsonKey(name: 'carbohydrates_on_100gr')
required int carbohydrates,
}) = _ProductModerationModel;
factory ProductModerationModel.fromJson(Map<String, Object?> json) => _$ProductModerationModelFromJson(json);
}

View File

@@ -0,0 +1,270 @@
// 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 'product_moderation_model.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#adding-getters-and-methods-to-our-models');
ProductModerationModel _$ProductModerationModelFromJson(
Map<String, dynamic> json) {
return _ProductModerationModel.fromJson(json);
}
/// @nodoc
mixin _$ProductModerationModel {
String get name => throw _privateConstructorUsedError;
@JsonKey(name: 'energy_on_100gr')
int get energy => throw _privateConstructorUsedError;
@JsonKey(name: 'proteins_on_100gr')
int get proteins => throw _privateConstructorUsedError;
@JsonKey(name: 'fats_on_100gr')
int get fats => throw _privateConstructorUsedError;
@JsonKey(name: 'carbohydrates_on_100gr')
int get carbohydrates => throw _privateConstructorUsedError;
/// Serializes this ProductModerationModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ProductModerationModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ProductModerationModelCopyWith<ProductModerationModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ProductModerationModelCopyWith<$Res> {
factory $ProductModerationModelCopyWith(ProductModerationModel value,
$Res Function(ProductModerationModel) then) =
_$ProductModerationModelCopyWithImpl<$Res, ProductModerationModel>;
@useResult
$Res call(
{String name,
@JsonKey(name: 'energy_on_100gr') int energy,
@JsonKey(name: 'proteins_on_100gr') int proteins,
@JsonKey(name: 'fats_on_100gr') int fats,
@JsonKey(name: 'carbohydrates_on_100gr') int carbohydrates});
}
/// @nodoc
class _$ProductModerationModelCopyWithImpl<$Res,
$Val extends ProductModerationModel>
implements $ProductModerationModelCopyWith<$Res> {
_$ProductModerationModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ProductModerationModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? energy = null,
Object? proteins = null,
Object? fats = null,
Object? carbohydrates = null,
}) {
return _then(_value.copyWith(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
energy: null == energy
? _value.energy
: energy // ignore: cast_nullable_to_non_nullable
as int,
proteins: null == proteins
? _value.proteins
: proteins // ignore: cast_nullable_to_non_nullable
as int,
fats: null == fats
? _value.fats
: fats // ignore: cast_nullable_to_non_nullable
as int,
carbohydrates: null == carbohydrates
? _value.carbohydrates
: carbohydrates // ignore: cast_nullable_to_non_nullable
as int,
) as $Val);
}
}
/// @nodoc
abstract class _$$ProductModerationModelImplCopyWith<$Res>
implements $ProductModerationModelCopyWith<$Res> {
factory _$$ProductModerationModelImplCopyWith(
_$ProductModerationModelImpl value,
$Res Function(_$ProductModerationModelImpl) then) =
__$$ProductModerationModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String name,
@JsonKey(name: 'energy_on_100gr') int energy,
@JsonKey(name: 'proteins_on_100gr') int proteins,
@JsonKey(name: 'fats_on_100gr') int fats,
@JsonKey(name: 'carbohydrates_on_100gr') int carbohydrates});
}
/// @nodoc
class __$$ProductModerationModelImplCopyWithImpl<$Res>
extends _$ProductModerationModelCopyWithImpl<$Res,
_$ProductModerationModelImpl>
implements _$$ProductModerationModelImplCopyWith<$Res> {
__$$ProductModerationModelImplCopyWithImpl(
_$ProductModerationModelImpl _value,
$Res Function(_$ProductModerationModelImpl) _then)
: super(_value, _then);
/// Create a copy of ProductModerationModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? energy = null,
Object? proteins = null,
Object? fats = null,
Object? carbohydrates = null,
}) {
return _then(_$ProductModerationModelImpl(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
energy: null == energy
? _value.energy
: energy // ignore: cast_nullable_to_non_nullable
as int,
proteins: null == proteins
? _value.proteins
: proteins // ignore: cast_nullable_to_non_nullable
as int,
fats: null == fats
? _value.fats
: fats // ignore: cast_nullable_to_non_nullable
as int,
carbohydrates: null == carbohydrates
? _value.carbohydrates
: carbohydrates // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ProductModerationModelImpl implements _ProductModerationModel {
const _$ProductModerationModelImpl(
{required this.name,
@JsonKey(name: 'energy_on_100gr') required this.energy,
@JsonKey(name: 'proteins_on_100gr') required this.proteins,
@JsonKey(name: 'fats_on_100gr') required this.fats,
@JsonKey(name: 'carbohydrates_on_100gr') required this.carbohydrates});
factory _$ProductModerationModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ProductModerationModelImplFromJson(json);
@override
final String name;
@override
@JsonKey(name: 'energy_on_100gr')
final int energy;
@override
@JsonKey(name: 'proteins_on_100gr')
final int proteins;
@override
@JsonKey(name: 'fats_on_100gr')
final int fats;
@override
@JsonKey(name: 'carbohydrates_on_100gr')
final int carbohydrates;
@override
String toString() {
return 'ProductModerationModel(name: $name, energy: $energy, proteins: $proteins, fats: $fats, carbohydrates: $carbohydrates)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProductModerationModelImpl &&
(identical(other.name, name) || other.name == name) &&
(identical(other.energy, energy) || other.energy == energy) &&
(identical(other.proteins, proteins) ||
other.proteins == proteins) &&
(identical(other.fats, fats) || other.fats == fats) &&
(identical(other.carbohydrates, carbohydrates) ||
other.carbohydrates == carbohydrates));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode =>
Object.hash(runtimeType, name, energy, proteins, fats, carbohydrates);
/// Create a copy of ProductModerationModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProductModerationModelImplCopyWith<_$ProductModerationModelImpl>
get copyWith => __$$ProductModerationModelImplCopyWithImpl<
_$ProductModerationModelImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$ProductModerationModelImplToJson(
this,
);
}
}
abstract class _ProductModerationModel implements ProductModerationModel {
const factory _ProductModerationModel(
{required final String name,
@JsonKey(name: 'energy_on_100gr') required final int energy,
@JsonKey(name: 'proteins_on_100gr') required final int proteins,
@JsonKey(name: 'fats_on_100gr') required final int fats,
@JsonKey(name: 'carbohydrates_on_100gr')
required final int carbohydrates}) = _$ProductModerationModelImpl;
factory _ProductModerationModel.fromJson(Map<String, dynamic> json) =
_$ProductModerationModelImpl.fromJson;
@override
String get name;
@override
@JsonKey(name: 'energy_on_100gr')
int get energy;
@override
@JsonKey(name: 'proteins_on_100gr')
int get proteins;
@override
@JsonKey(name: 'fats_on_100gr')
int get fats;
@override
@JsonKey(name: 'carbohydrates_on_100gr')
int get carbohydrates;
/// Create a copy of ProductModerationModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProductModerationModelImplCopyWith<_$ProductModerationModelImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,27 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'product_moderation_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$ProductModerationModelImpl _$$ProductModerationModelImplFromJson(
Map<String, dynamic> json) =>
_$ProductModerationModelImpl(
name: json['name'] as String,
energy: (json['energy_on_100gr'] as num).toInt(),
proteins: (json['proteins_on_100gr'] as num).toInt(),
fats: (json['fats_on_100gr'] as num).toInt(),
carbohydrates: (json['carbohydrates_on_100gr'] as num).toInt(),
);
Map<String, dynamic> _$$ProductModerationModelImplToJson(
_$ProductModerationModelImpl instance) =>
<String, dynamic>{
'name': instance.name,
'energy_on_100gr': instance.energy,
'proteins_on_100gr': instance.proteins,
'fats_on_100gr': instance.fats,
'carbohydrates_on_100gr': instance.carbohydrates,
};