Formatting + README

This commit is contained in:
Tobe O 2018-07-11 11:49:46 -04:00
parent e6f82341d1
commit 02bc431334
14 changed files with 70 additions and 13 deletions

View file

@ -82,6 +82,11 @@ The following files will be generated:
* `book.g.dart`
* `book.serializer.g.dart`
Producing these classes:
* `Book`: Extends or implements `_Book`; may be `const`-enabled.
* `BookSerializer`: static functionality for serializing `Book` models.
* `BookFields`: The names of all fields from the `Book` model, statically-available.
# Serialization
You can use the generated files as follows:

View file

@ -42,7 +42,8 @@ class GeneratedSerializable {
const GeneratedSerializable();
}
const GeneratedSerializable generatedSerializable = const GeneratedSerializable();
const GeneratedSerializable generatedSerializable =
const GeneratedSerializable();
/// The supported serialization types.
abstract class Serializers {

View file

@ -66,6 +66,18 @@ abstract class AuthorSerializer {
}
abstract class AuthorFields {
static const List<String> allFields = const <String>[
id,
name,
age,
books,
newestBook,
secret,
obscured,
createdAt,
updatedAt
];
static const String id = 'id';
static const String name = 'name';
@ -125,6 +137,13 @@ abstract class LibrarySerializer {
}
abstract class LibraryFields {
static const List<String> allFields = const <String>[
id,
collection,
createdAt,
updatedAt
];
static const String id = 'id';
static const String collection = 'collection';
@ -177,6 +196,15 @@ abstract class BookmarkSerializer {
}
abstract class BookmarkFields {
static const List<String> allFields = const <String>[
id,
history,
page,
comment,
createdAt,
updatedAt
];
static const String id = 'id';
static const String history = 'history';

View file

@ -47,6 +47,18 @@ abstract class BookSerializer {
}
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';

View file

@ -1,12 +1,16 @@
import 'package:angel_serialize/angel_serialize.dart';
import 'package:collection/collection.dart';
import 'game_pad_button.dart';
part 'game_pad.g.dart';
part 'game_pad.serializer.g.dart';
@Serializable(autoIdAndDateFields: false)
abstract class _Gamepad {
List<GamepadButton> get buttons;
class _Gamepad {
List<GamepadButton> buttons;
Map<String, dynamic> get dynamicMap;
Map<String, dynamic> dynamicMap;
String _somethingPrivate;
}

View file

@ -7,9 +7,10 @@ part of 'game_pad.dart';
// **************************************************************************
@generatedSerializable
class Gamepad implements _Gamepad {
const Gamepad(
{List<GamepadButton> this.buttons, Map<String, dynamic> this.dynamicMap});
class Gamepad extends _Gamepad {
Gamepad({List<GamepadButton> buttons, Map<String, dynamic> dynamicMap})
: this.buttons = new List.unmodifiable(buttons ?? []),
this.dynamicMap = new Map.unmodifiable(dynamicMap ?? {});
@override
final List<GamepadButton> buttons;

View file

@ -29,6 +29,8 @@ abstract class GamepadSerializer {
}
abstract class GamepadFields {
static const List<String> allFields = const <String>[buttons, dynamicMap];
static const String buttons = 'buttons';
static const String dynamicMap = 'dynamic_map';

View file

@ -21,6 +21,8 @@ abstract class GamepadButtonSerializer {
}
abstract class GamepadButtonFields {
static const List<String> allFields = const <String>[name, radius];
static const String name = 'name';
static const String radius = 'radius';

View file

@ -30,6 +30,8 @@ abstract class WithEnumSerializer {
}
abstract class WithEnumFields {
static const List<String> allFields = const <String>[type, finalList];
static const String type = 'type';
static const String finalList = 'final_list';