This commit is contained in:
mso7nueh
2024-07-31 13:29:05 +03:00
parent 4f7f660cbd
commit b7ca00b948
13 changed files with 167 additions and 113 deletions

View File

@@ -7,7 +7,8 @@ part 'photo.g.dart';
class Photo with _$Photo {
const factory Photo({
required int id,
required String original_name,
@JsonKey(name: 'original_name')
required String originalName,
required String path,
}) = _Photo;

View File

@@ -21,7 +21,8 @@ Photo _$PhotoFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$Photo {
int get id => throw _privateConstructorUsedError;
String get original_name => throw _privateConstructorUsedError;
@JsonKey(name: 'original_name')
String get originalName => throw _privateConstructorUsedError;
String get path => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -34,7 +35,10 @@ abstract class $PhotoCopyWith<$Res> {
factory $PhotoCopyWith(Photo value, $Res Function(Photo) then) =
_$PhotoCopyWithImpl<$Res, Photo>;
@useResult
$Res call({int id, String original_name, String path});
$Res call(
{int id,
@JsonKey(name: 'original_name') String originalName,
String path});
}
/// @nodoc
@@ -51,7 +55,7 @@ class _$PhotoCopyWithImpl<$Res, $Val extends Photo>
@override
$Res call({
Object? id = null,
Object? original_name = null,
Object? originalName = null,
Object? path = null,
}) {
return _then(_value.copyWith(
@@ -59,9 +63,9 @@ class _$PhotoCopyWithImpl<$Res, $Val extends Photo>
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
original_name: null == original_name
? _value.original_name
: original_name // ignore: cast_nullable_to_non_nullable
originalName: null == originalName
? _value.originalName
: originalName // ignore: cast_nullable_to_non_nullable
as String,
path: null == path
? _value.path
@@ -78,7 +82,10 @@ abstract class _$$PhotoImplCopyWith<$Res> implements $PhotoCopyWith<$Res> {
__$$PhotoImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({int id, String original_name, String path});
$Res call(
{int id,
@JsonKey(name: 'original_name') String originalName,
String path});
}
/// @nodoc
@@ -93,7 +100,7 @@ class __$$PhotoImplCopyWithImpl<$Res>
@override
$Res call({
Object? id = null,
Object? original_name = null,
Object? originalName = null,
Object? path = null,
}) {
return _then(_$PhotoImpl(
@@ -101,9 +108,9 @@ class __$$PhotoImplCopyWithImpl<$Res>
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
original_name: null == original_name
? _value.original_name
: original_name // ignore: cast_nullable_to_non_nullable
originalName: null == originalName
? _value.originalName
: originalName // ignore: cast_nullable_to_non_nullable
as String,
path: null == path
? _value.path
@@ -117,7 +124,9 @@ class __$$PhotoImplCopyWithImpl<$Res>
@JsonSerializable()
class _$PhotoImpl implements _Photo {
const _$PhotoImpl(
{required this.id, required this.original_name, required this.path});
{required this.id,
@JsonKey(name: 'original_name') required this.originalName,
required this.path});
factory _$PhotoImpl.fromJson(Map<String, dynamic> json) =>
_$$PhotoImplFromJson(json);
@@ -125,13 +134,14 @@ class _$PhotoImpl implements _Photo {
@override
final int id;
@override
final String original_name;
@JsonKey(name: 'original_name')
final String originalName;
@override
final String path;
@override
String toString() {
return 'Photo(id: $id, original_name: $original_name, path: $path)';
return 'Photo(id: $id, originalName: $originalName, path: $path)';
}
@override
@@ -140,14 +150,14 @@ class _$PhotoImpl implements _Photo {
(other.runtimeType == runtimeType &&
other is _$PhotoImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.original_name, original_name) ||
other.original_name == original_name) &&
(identical(other.originalName, originalName) ||
other.originalName == originalName) &&
(identical(other.path, path) || other.path == path));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, id, original_name, path);
int get hashCode => Object.hash(runtimeType, id, originalName, path);
@JsonKey(ignore: true)
@override
@@ -166,7 +176,7 @@ class _$PhotoImpl implements _Photo {
abstract class _Photo implements Photo {
const factory _Photo(
{required final int id,
required final String original_name,
@JsonKey(name: 'original_name') required final String originalName,
required final String path}) = _$PhotoImpl;
factory _Photo.fromJson(Map<String, dynamic> json) = _$PhotoImpl.fromJson;
@@ -174,7 +184,8 @@ abstract class _Photo implements Photo {
@override
int get id;
@override
String get original_name;
@JsonKey(name: 'original_name')
String get originalName;
@override
String get path;
@override

View File

@@ -8,13 +8,13 @@ part of 'photo.dart';
_$PhotoImpl _$$PhotoImplFromJson(Map<String, dynamic> json) => _$PhotoImpl(
id: (json['id'] as num).toInt(),
original_name: json['original_name'] as String,
originalName: json['original_name'] as String,
path: json['path'] as String,
);
Map<String, dynamic> _$$PhotoImplToJson(_$PhotoImpl instance) =>
<String, dynamic>{
'id': instance.id,
'original_name': instance.original_name,
'original_name': instance.originalName,
'path': instance.path,
};