platform/angel_serialize_generator/test/models/book.g.dart

75 lines
1.7 KiB
Dart
Raw Normal View History

2017-06-17 01:26:19 +00:00
// GENERATED CODE - DO NOT MODIFY BY HAND
part of angel_serialize.test.models.book;
// **************************************************************************
// Generator: JsonModelGenerator
// **************************************************************************
class Book extends _Book {
@override
String id;
@override
String author;
@override
String title;
@override
String description;
@override
int pageCount;
@override
DateTime createdAt;
@override
DateTime updatedAt;
Book(
{this.id,
this.author,
this.title,
this.description,
this.pageCount,
this.createdAt,
this.updatedAt});
factory Book.fromJson(Map data) {
return new Book(
id: data['id'],
author: data['author'],
title: data['title'],
description: data['description'],
pageCount: data['page_count'],
2017-06-20 22:13:04 +00:00
createdAt: data['created_at'] is DateTime
? data['created_at']
: (data['created_at'] is String
? DateTime.parse(data['created_at'])
2017-06-17 01:26:19 +00:00
: null),
2017-06-20 22:13:04 +00:00
updatedAt: data['updated_at'] is DateTime
? data['updated_at']
: (data['updated_at'] is String
? DateTime.parse(data['updated_at'])
2017-06-17 01:26:19 +00:00
: null));
}
Map<String, dynamic> toJson() => {
'id': id,
'author': author,
'title': title,
'description': description,
'page_count': pageCount,
2017-06-20 22:13:04 +00:00
'created_at': createdAt == null ? null : createdAt.toIso8601String(),
'updated_at': updatedAt == null ? null : updatedAt.toIso8601String()
2017-06-17 01:26:19 +00:00
};
static Book parse(Map map) => new Book.fromJson(map);
2017-07-10 15:15:09 +00:00
Book clone() {
return new Book.fromJson(toJson());
}
2017-06-17 01:26:19 +00:00
}