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

185 lines
4.6 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;
// **************************************************************************
2018-06-29 04:11:57 +00:00
// JsonModelGenerator
2017-06-17 01:26:19 +00:00
// **************************************************************************
@generatedSerializable
2019-01-07 00:56:05 +00:00
@pragma('hello')
@SerializableField(alias: 'omg')
2018-02-27 19:57:05 +00:00
class Book extends _Book {
Book(
{this.id,
this.author,
this.title,
this.description,
this.pageCount,
2018-05-15 19:01:13 +00:00
List<double> notModels,
2018-03-09 12:43:17 +00:00
this.camelCaseString,
2018-02-27 19:57:05 +00:00
this.createdAt,
2018-05-15 19:01:13 +00:00
this.updatedAt})
: this.notModels = new List.unmodifiable(notModels ?? []);
2018-02-27 19:57:05 +00:00
2018-02-28 00:36:53 +00:00
@override
2018-02-27 19:47:42 +00:00
final String id;
2017-06-17 01:26:19 +00:00
2018-02-28 00:36:53 +00:00
@override
2018-02-27 19:47:42 +00:00
final String author;
2017-06-17 01:26:19 +00:00
2018-02-28 00:36:53 +00:00
@override
2018-02-27 19:47:42 +00:00
final String title;
2017-06-17 01:26:19 +00:00
2018-02-28 00:36:53 +00:00
@override
2018-02-27 19:47:42 +00:00
final String description;
2017-06-17 01:26:19 +00:00
2018-02-28 00:36:53 +00:00
@override
2018-02-27 19:47:42 +00:00
final int pageCount;
2017-06-17 01:26:19 +00:00
2018-03-05 06:18:46 +00:00
@override
final List<double> notModels;
2018-03-09 12:43:17 +00:00
@override
final String camelCaseString;
2018-02-28 00:36:53 +00:00
@override
2018-02-27 19:47:42 +00:00
final DateTime createdAt;
2017-06-17 01:26:19 +00:00
2018-02-28 00:36:53 +00:00
@override
2018-02-27 19:47:42 +00:00
final DateTime updatedAt;
2018-02-28 00:36:53 +00:00
Book copyWith(
{String id,
String author,
String title,
String description,
int pageCount,
2018-03-05 06:18:46 +00:00
List<double> notModels,
2018-03-09 12:43:17 +00:00
String camelCaseString,
2018-02-28 00:36:53 +00:00
DateTime createdAt,
DateTime updatedAt}) {
return new Book(
id: id ?? this.id,
author: author ?? this.author,
title: title ?? this.title,
description: description ?? this.description,
pageCount: pageCount ?? this.pageCount,
2018-03-05 06:18:46 +00:00
notModels: notModels ?? this.notModels,
2018-03-09 12:43:17 +00:00
camelCaseString: camelCaseString ?? this.camelCaseString,
2018-02-28 00:36:53 +00:00
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt);
}
2018-02-28 01:49:14 +00:00
2018-05-13 18:02:47 +00:00
bool operator ==(other) {
return other is _Book &&
other.id == id &&
other.author == author &&
other.title == title &&
other.description == description &&
other.pageCount == pageCount &&
const ListEquality<double>(const DefaultEquality<double>())
.equals(other.notModels, notModels) &&
other.camelCaseString == camelCaseString &&
other.createdAt == createdAt &&
other.updatedAt == updatedAt;
}
2018-11-03 07:36:59 +00:00
@override
int get hashCode {
return hashObjects([
id,
author,
title,
description,
pageCount,
notModels,
camelCaseString,
createdAt,
updatedAt
]);
}
2018-02-28 01:49:14 +00:00
Map<String, dynamic> toJson() {
return BookSerializer.toMap(this);
}
2017-06-17 01:26:19 +00:00
}
2018-12-08 20:53:49 +00:00
// **************************************************************************
// SerializerGenerator
// **************************************************************************
abstract class BookSerializer {
static Book fromMap(Map map) {
return new Book(
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'] is Iterable
? (map['not_models'] as Iterable).cast<double>().toList()
: null,
camelCaseString: map['camelCase'] as String,
createdAt: map['created_at'] != null
? (map['created_at'] is DateTime
? (map['created_at'] as DateTime)
: DateTime.parse(map['created_at'].toString()))
: null,
updatedAt: map['updated_at'] != null
? (map['updated_at'] is DateTime
? (map['updated_at'] as DateTime)
: DateTime.parse(map['updated_at'].toString()))
: null);
}
2018-12-08 22:31:12 +00:00
static Map<String, dynamic> toMap(_Book model) {
2018-12-08 20:53:49 +00:00
if (model == null) {
return null;
}
return {
'id': model.id,
'author': model.author,
'title': model.title,
'description': model.description,
'page_count': model.pageCount,
'not_models': model.notModels,
'camelCase': model.camelCaseString,
'created_at': model.createdAt?.toIso8601String(),
'updated_at': model.updatedAt?.toIso8601String()
};
}
}
abstract class BookFields {
static const List<String> allFields = const <String>[
id,
author,
title,
description,
pageCount,
notModels,
camelCaseString,
createdAt,
updatedAt
];
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';
static const String camelCaseString = 'camelCase';
static const String createdAt = 'created_at';
static const String updatedAt = 'updated_at';
}