Правки + иконка
This commit is contained in:
@@ -2,26 +2,41 @@
|
||||
//
|
||||
// final collectionDto = collectionDtoFromJson(jsonString);
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'collection_dto.freezed.dart';
|
||||
part 'collection_dto.g.dart';
|
||||
// part 'collection_dto.g.dart';
|
||||
|
||||
CollectionDto collectionDtoFromJson(String str) =>
|
||||
CollectionDto.fromJson(json.decode(str));
|
||||
// CollectionDto collectionDtoFromJson(String str) =>
|
||||
// CollectionDto.fromJson(json.decode(str));
|
||||
|
||||
String collectionDtoToJson(CollectionDto data) => json.encode(data.toJson());
|
||||
// String collectionDtoToJson(CollectionDto data) => json.encode(data.toJson());
|
||||
|
||||
@freezed
|
||||
class CollectionDto with _$CollectionDto {
|
||||
// class Uint8ListConverter implements JsonConverter<Uint8List?, List<int>?> {
|
||||
// const Uint8ListConverter();
|
||||
|
||||
// @override
|
||||
// Uint8List? fromJson(List<int>? json) {
|
||||
// return json == null ? null : Uint8List.fromList(json);
|
||||
// }
|
||||
|
||||
// @override
|
||||
// List<int>? toJson(Uint8List? object) {
|
||||
// return object?.toList();
|
||||
// }
|
||||
// }
|
||||
|
||||
@Freezed(copyWith: true, equal: true, fromJson: false, toJson: false)
|
||||
abstract class CollectionDto with _$CollectionDto {
|
||||
const factory CollectionDto({
|
||||
required String desc,
|
||||
required String title,
|
||||
required bool isPublic,
|
||||
String? avatar,
|
||||
Uint8List? avatar,
|
||||
}) = _CollectionDto;
|
||||
|
||||
factory CollectionDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$CollectionDtoFromJson(json);
|
||||
// factory CollectionDto.fromJson(Map<String, dynamic> json) =>
|
||||
// _$CollectionDtoFromJson(json);
|
||||
}
|
||||
|
||||
@@ -15,19 +15,12 @@ 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',
|
||||
);
|
||||
|
||||
CollectionDto _$CollectionDtoFromJson(Map<String, dynamic> json) {
|
||||
return _CollectionDto.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CollectionDto {
|
||||
String get desc => throw _privateConstructorUsedError;
|
||||
String get title => throw _privateConstructorUsedError;
|
||||
bool get isPublic => throw _privateConstructorUsedError;
|
||||
String? get avatar => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this CollectionDto to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
Uint8List? get avatar => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of CollectionDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -43,7 +36,7 @@ abstract class $CollectionDtoCopyWith<$Res> {
|
||||
$Res Function(CollectionDto) then,
|
||||
) = _$CollectionDtoCopyWithImpl<$Res, CollectionDto>;
|
||||
@useResult
|
||||
$Res call({String desc, String title, bool isPublic, String? avatar});
|
||||
$Res call({String desc, String title, bool isPublic, Uint8List? avatar});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -87,7 +80,7 @@ class _$CollectionDtoCopyWithImpl<$Res, $Val extends CollectionDto>
|
||||
freezed == avatar
|
||||
? _value.avatar
|
||||
: avatar // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
as Uint8List?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
@@ -103,7 +96,7 @@ abstract class _$$CollectionDtoImplCopyWith<$Res>
|
||||
) = __$$CollectionDtoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String desc, String title, bool isPublic, String? avatar});
|
||||
$Res call({String desc, String title, bool isPublic, Uint8List? avatar});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -146,14 +139,14 @@ class __$$CollectionDtoImplCopyWithImpl<$Res>
|
||||
freezed == avatar
|
||||
? _value.avatar
|
||||
: avatar // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
as Uint8List?,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _$CollectionDtoImpl implements _CollectionDto {
|
||||
const _$CollectionDtoImpl({
|
||||
required this.desc,
|
||||
@@ -162,9 +155,6 @@ class _$CollectionDtoImpl implements _CollectionDto {
|
||||
this.avatar,
|
||||
});
|
||||
|
||||
factory _$CollectionDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$CollectionDtoImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String desc;
|
||||
@override
|
||||
@@ -172,7 +162,7 @@ class _$CollectionDtoImpl implements _CollectionDto {
|
||||
@override
|
||||
final bool isPublic;
|
||||
@override
|
||||
final String? avatar;
|
||||
final Uint8List? avatar;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -188,12 +178,17 @@ class _$CollectionDtoImpl implements _CollectionDto {
|
||||
(identical(other.title, title) || other.title == title) &&
|
||||
(identical(other.isPublic, isPublic) ||
|
||||
other.isPublic == isPublic) &&
|
||||
(identical(other.avatar, avatar) || other.avatar == avatar));
|
||||
const DeepCollectionEquality().equals(other.avatar, avatar));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, desc, title, isPublic, avatar);
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
desc,
|
||||
title,
|
||||
isPublic,
|
||||
const DeepCollectionEquality().hash(avatar),
|
||||
);
|
||||
|
||||
/// Create a copy of CollectionDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -202,11 +197,6 @@ class _$CollectionDtoImpl implements _CollectionDto {
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CollectionDtoImplCopyWith<_$CollectionDtoImpl> get copyWith =>
|
||||
__$$CollectionDtoImplCopyWithImpl<_$CollectionDtoImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$CollectionDtoImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _CollectionDto implements CollectionDto {
|
||||
@@ -214,12 +204,9 @@ abstract class _CollectionDto implements CollectionDto {
|
||||
required final String desc,
|
||||
required final String title,
|
||||
required final bool isPublic,
|
||||
final String? avatar,
|
||||
final Uint8List? avatar,
|
||||
}) = _$CollectionDtoImpl;
|
||||
|
||||
factory _CollectionDto.fromJson(Map<String, dynamic> json) =
|
||||
_$CollectionDtoImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get desc;
|
||||
@override
|
||||
@@ -227,7 +214,7 @@ abstract class _CollectionDto implements CollectionDto {
|
||||
@override
|
||||
bool get isPublic;
|
||||
@override
|
||||
String? get avatar;
|
||||
Uint8List? get avatar;
|
||||
|
||||
/// Create a copy of CollectionDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'collection_dto.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$CollectionDtoImpl _$$CollectionDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
_$CollectionDtoImpl(
|
||||
desc: json['desc'] as String,
|
||||
title: json['title'] as String,
|
||||
isPublic: json['isPublic'] as bool,
|
||||
avatar: json['avatar'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$CollectionDtoImplToJson(_$CollectionDtoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'desc': instance.desc,
|
||||
'title': instance.title,
|
||||
'isPublic': instance.isPublic,
|
||||
'avatar': instance.avatar,
|
||||
};
|
||||
Reference in New Issue
Block a user