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

68 lines
2 KiB
Dart
Raw Normal View History

// GENERATED CODE - DO NOT MODIFY BY HAND
part of angel_serialize.test.models.book;
// **************************************************************************
2018-06-29 04:11:57 +00:00
// SerializerGenerator
// **************************************************************************
2018-02-28 01:10:57 +00:00
abstract class BookSerializer {
2018-03-09 12:45:03 +00:00
static Book fromMap(Map map) {
2018-02-28 02:10:43 +00:00
return new Book(
2018-06-27 05:36:57 +00:00
id: map['id'] as String,
author: map['author'] as String,
title: map['title'] as String,
description: map['description'] as String,
pageCount: map['page_count'] as int,
notModels: map['not_models'] as List<double>,
camelCaseString: map['camelCase'] as String,
2018-02-28 02:10:43 +00:00
createdAt: map['created_at'] != null
? (map['created_at'] is DateTime
2018-06-27 05:36:57 +00:00
? (map['created_at'] as DateTime)
: DateTime.parse(map['created_at']))
2018-02-28 02:10:43 +00:00
: null,
updatedAt: map['updated_at'] != null
? (map['updated_at'] is DateTime
2018-06-27 05:36:57 +00:00
? (map['updated_at'] as DateTime)
: DateTime.parse(map['updated_at']))
2018-02-28 02:10:43 +00:00
: null);
}
2018-02-28 01:41:19 +00:00
static Map<String, dynamic> toMap(Book model) {
2018-06-28 01:58:42 +00:00
if (model == null) {
return null;
}
2018-02-28 01:10:57 +00:00
return {
2018-02-28 01:41:19 +00:00
'id': model.id,
'author': model.author,
'title': model.title,
'description': model.description,
'page_count': model.pageCount,
2018-03-05 06:18:46 +00:00
'not_models': model.notModels,
2018-03-09 12:43:17 +00:00
'camelCase': model.camelCaseString,
2018-02-28 02:10:43 +00:00
'created_at': model.createdAt?.toIso8601String(),
'updated_at': model.updatedAt?.toIso8601String()
2018-02-28 01:10:57 +00:00
};
}
}
2018-03-09 12:39:21 +00:00
abstract class BookFields {
static const String id = 'id';
static const String author = 'author';
static const String title = 'title';
static const String description = 'description';
static const String pageCount = 'page_count';
static const String notModels = 'not_models';
2018-03-09 12:43:17 +00:00
static const String camelCaseString = 'camelCase';
2018-03-09 12:39:21 +00:00
static const String createdAt = 'created_at';
static const String updatedAt = 'updated_at';
}