Formatting + README
This commit is contained in:
parent
e6f82341d1
commit
02bc431334
14 changed files with 70 additions and 13 deletions
|
@ -82,6 +82,11 @@ The following files will be generated:
|
||||||
* `book.g.dart`
|
* `book.g.dart`
|
||||||
* `book.serializer.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
|
# Serialization
|
||||||
|
|
||||||
You can use the generated files as follows:
|
You can use the generated files as follows:
|
||||||
|
|
|
@ -4,4 +4,4 @@ import 'package:angel_serialize/angel_serialize.dart';
|
||||||
class _Todo {
|
class _Todo {
|
||||||
String text;
|
String text;
|
||||||
bool completed;
|
bool completed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,8 @@ class GeneratedSerializable {
|
||||||
const GeneratedSerializable();
|
const GeneratedSerializable();
|
||||||
}
|
}
|
||||||
|
|
||||||
const GeneratedSerializable generatedSerializable = const GeneratedSerializable();
|
const GeneratedSerializable generatedSerializable =
|
||||||
|
const GeneratedSerializable();
|
||||||
|
|
||||||
/// The supported serialization types.
|
/// The supported serialization types.
|
||||||
abstract class Serializers {
|
abstract class Serializers {
|
||||||
|
|
|
@ -4,4 +4,4 @@ import 'package:angel_serialize/angel_serialize.dart';
|
||||||
class _Todo {
|
class _Todo {
|
||||||
String text;
|
String text;
|
||||||
bool completed;
|
bool completed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,18 @@ abstract class AuthorSerializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class AuthorFields {
|
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 id = 'id';
|
||||||
|
|
||||||
static const String name = 'name';
|
static const String name = 'name';
|
||||||
|
@ -125,6 +137,13 @@ abstract class LibrarySerializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class LibraryFields {
|
abstract class LibraryFields {
|
||||||
|
static const List<String> allFields = const <String>[
|
||||||
|
id,
|
||||||
|
collection,
|
||||||
|
createdAt,
|
||||||
|
updatedAt
|
||||||
|
];
|
||||||
|
|
||||||
static const String id = 'id';
|
static const String id = 'id';
|
||||||
|
|
||||||
static const String collection = 'collection';
|
static const String collection = 'collection';
|
||||||
|
@ -177,6 +196,15 @@ abstract class BookmarkSerializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class BookmarkFields {
|
abstract class BookmarkFields {
|
||||||
|
static const List<String> allFields = const <String>[
|
||||||
|
id,
|
||||||
|
history,
|
||||||
|
page,
|
||||||
|
comment,
|
||||||
|
createdAt,
|
||||||
|
updatedAt
|
||||||
|
];
|
||||||
|
|
||||||
static const String id = 'id';
|
static const String id = 'id';
|
||||||
|
|
||||||
static const String history = 'history';
|
static const String history = 'history';
|
||||||
|
|
|
@ -14,4 +14,4 @@ abstract class _Book extends Model {
|
||||||
|
|
||||||
@Alias('camelCase')
|
@Alias('camelCase')
|
||||||
String camelCaseString;
|
String camelCaseString;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,18 @@ abstract class BookSerializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class BookFields {
|
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 id = 'id';
|
||||||
|
|
||||||
static const String author = 'author';
|
static const String author = 'author';
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
import 'package:angel_serialize/angel_serialize.dart';
|
import 'package:angel_serialize/angel_serialize.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'game_pad_button.dart';
|
import 'game_pad_button.dart';
|
||||||
|
|
||||||
part 'game_pad.g.dart';
|
part 'game_pad.g.dart';
|
||||||
|
|
||||||
part 'game_pad.serializer.g.dart';
|
part 'game_pad.serializer.g.dart';
|
||||||
|
|
||||||
@Serializable(autoIdAndDateFields: false)
|
@Serializable(autoIdAndDateFields: false)
|
||||||
abstract class _Gamepad {
|
class _Gamepad {
|
||||||
List<GamepadButton> get buttons;
|
List<GamepadButton> buttons;
|
||||||
|
|
||||||
Map<String, dynamic> get dynamicMap;
|
Map<String, dynamic> dynamicMap;
|
||||||
}
|
|
||||||
|
String _somethingPrivate;
|
||||||
|
}
|
||||||
|
|
|
@ -7,9 +7,10 @@ part of 'game_pad.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class Gamepad implements _Gamepad {
|
class Gamepad extends _Gamepad {
|
||||||
const Gamepad(
|
Gamepad({List<GamepadButton> buttons, Map<String, dynamic> dynamicMap})
|
||||||
{List<GamepadButton> this.buttons, Map<String, dynamic> this.dynamicMap});
|
: this.buttons = new List.unmodifiable(buttons ?? []),
|
||||||
|
this.dynamicMap = new Map.unmodifiable(dynamicMap ?? {});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final List<GamepadButton> buttons;
|
final List<GamepadButton> buttons;
|
||||||
|
|
|
@ -29,6 +29,8 @@ abstract class GamepadSerializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class GamepadFields {
|
abstract class GamepadFields {
|
||||||
|
static const List<String> allFields = const <String>[buttons, dynamicMap];
|
||||||
|
|
||||||
static const String buttons = 'buttons';
|
static const String buttons = 'buttons';
|
||||||
|
|
||||||
static const String dynamicMap = 'dynamic_map';
|
static const String dynamicMap = 'dynamic_map';
|
||||||
|
|
|
@ -6,4 +6,4 @@ part 'game_pad_button.serializer.g.dart';
|
||||||
abstract class _GamepadButton {
|
abstract class _GamepadButton {
|
||||||
String get name;
|
String get name;
|
||||||
int get radius;
|
int get radius;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ abstract class GamepadButtonSerializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class GamepadButtonFields {
|
abstract class GamepadButtonFields {
|
||||||
|
static const List<String> allFields = const <String>[name, radius];
|
||||||
|
|
||||||
static const String name = 'name';
|
static const String name = 'name';
|
||||||
|
|
||||||
static const String radius = 'radius';
|
static const String radius = 'radius';
|
||||||
|
|
|
@ -30,6 +30,8 @@ abstract class WithEnumSerializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class WithEnumFields {
|
abstract class WithEnumFields {
|
||||||
|
static const List<String> allFields = const <String>[type, finalList];
|
||||||
|
|
||||||
static const String type = 'type';
|
static const String type = 'type';
|
||||||
|
|
||||||
static const String finalList = 'final_list';
|
static const String finalList = 'final_list';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import 'package:build_runner/build_runner.dart';
|
import 'package:build_runner/build_runner.dart';
|
||||||
import 'applications.dart';
|
import 'applications.dart';
|
||||||
|
|
||||||
main() => build(applications, deleteFilesByDefault: true, verbose: false);
|
main() => build(applications, deleteFilesByDefault: true, verbose: false);
|
||||||
|
|
Loading…
Reference in a new issue