Создание коллекций
This commit is contained in:
27
lib/models/collection_dto.dart
Normal file
27
lib/models/collection_dto.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final collectionDto = collectionDtoFromJson(jsonString);
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
part 'collection_dto.freezed.dart';
|
||||
part 'collection_dto.g.dart';
|
||||
|
||||
CollectionDto collectionDtoFromJson(String str) =>
|
||||
CollectionDto.fromJson(json.decode(str));
|
||||
|
||||
String collectionDtoToJson(CollectionDto data) => json.encode(data.toJson());
|
||||
|
||||
@freezed
|
||||
class CollectionDto with _$CollectionDto {
|
||||
const factory CollectionDto({
|
||||
required String desc,
|
||||
required String title,
|
||||
required bool isPublic,
|
||||
String? avatar,
|
||||
}) = _CollectionDto;
|
||||
|
||||
factory CollectionDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$CollectionDtoFromJson(json);
|
||||
}
|
||||
Reference in New Issue
Block a user