Merge pull request #7 from dukefirehawk/angel3

Updated auth, model, container and container generator
This commit is contained in:
Thomas Hii 2021-09-26 14:58:11 +08:00 committed by GitHub
commit 4a632451dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 487 additions and 320 deletions

View file

@ -1,5 +1,9 @@
# Change Log # Change Log
## 4.1.0
* Updated linter to `package:lints`
## 4.0.5 ## 4.0.5
* Added support for verifier function to return an empty Map instead of null * Added support for verifier function to return an empty Map instead of null

View file

@ -1,21 +1,29 @@
MIT License (MIT) BSD 3-Clause License
Copyright (c) 2021 dukefirehawk.com Copyright (c) 2021, dukefirehawk.com
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy Redistribution and use in source and binary forms, with or without
of this software and associated documentation files (the "Software"), to deal modification, are permitted provided that the following conditions are met:
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all 1. Redistributions of source code must retain the above copyright notice, this
copies or substantial portions of the Software. list of conditions and the following disclaimer.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2. Redistributions in binary form must reproduce the above copyright notice,
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, this list of conditions and the following disclaimer in the documentation
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE and/or other materials provided with the distribution.
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3. Neither the name of the copyright holder nor the names of its
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE contributors may be used to endorse or promote products derived from
SOFTWARE. this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -1,10 +1,9 @@
# Angel3 Anthentication # Angel3 Anthentication
[![version](https://img.shields.io/badge/pub-v4.0.5-brightgreen)](https://pub.dev/packages/angel3_auth) ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_auth?include_prereleases)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion) [![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/master/packages/auth/LICENSE)
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/auth/LICENSE)
A complete authentication plugin for Angel3. Inspired by Passport. More details in the [User Guide](https://angel3-docs.dukefirehawk.com/guides/authentication). A complete authentication plugin for Angel3. Inspired by Passport. More details in the [User Guide](https://angel3-docs.dukefirehawk.com/guides/authentication).
@ -52,7 +51,7 @@ configureServer(Angel app) async {
## Default Authentication Callback ## Default Authentication Callback
A frequent use case within SPA's is opening OAuth login endpoints in a separate window. [`angel3_client`](https://github.com/dukefirehawk/angel/tree/angel3/packages/client) provides a facility for this, which works perfectly with the default callback provided in this package. A frequent use case within SPA's is opening OAuth login endpoints in a separate window. [`angel3_client`](https://pub.dev/packages/angel3_client) provides a facility for this, which works perfectly with the default callback provided in this package.
```dart ```dart
configureServer(Angel app) async { configureServer(Angel app) async {
@ -75,7 +74,7 @@ configureServer(Angel app) async {
} }
``` ```
This renders a simple HTML page that fires the user's JWT as a `token` event in `window.opener`. `angel3_client` [exposes this as a Stream](https://github.com/dukefirehawk/angel/tree/angel3/packages/client#authentication): This renders a simple HTML page that fires the user's JWT as a `token` event in `window.opener`. `angel3_client` [exposes this as a Stream](https://pub.dev/documentation/angel3_client/latest/):
```dart ```dart
app.authenticateViaPopup('/auth/google').listen((jwt) { app.authenticateViaPopup('/auth/google').listen((jwt) {

View file

@ -1,4 +1,2 @@
include: package:pedantic/analysis_options.yaml
analyzer: include: package:lints/recommended.yaml
strong-mode:
implicit-casts: false

View file

@ -1,12 +1,12 @@
name: angel3_auth name: angel3_auth
description: A complete authentication plugin for Angel. Includes support for stateless JWT tokens, Basic Auth, and more. description: A complete authentication plugin for Angel3. Includes support for stateless JWT tokens, Basic Auth, and more.
version: 4.0.5 version: 4.1.0
homepage: https://angel3-framework.web.app/ homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/auth repository: https://github.com/dukefirehawk/angel/tree/master/packages/auth
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'
dependencies: dependencies:
angel3_framework: ^4.0.0 angel3_framework: ^4.2.0
charcode: ^1.2.0 charcode: ^1.2.0
collection: ^1.15.0 collection: ^1.15.0
crypto: ^3.0.0 crypto: ^3.0.0
@ -15,9 +15,11 @@ dependencies:
quiver: ^3.0.0 quiver: ^3.0.0
logging: ^1.0.0 logging: ^1.0.0
dev_dependencies: dev_dependencies:
angel3_container: ^3.0.0 angel3_container: ^3.1.0
http: ^0.13.1 http: ^0.13.1
io: ^1.0.0 io: ^1.0.0
pedantic: ^1.11.0
test: ^1.17.4 test: ^1.17.4
lints: ^1.0.0
dependency_overrides:
angel3_container:
path: ../container/angel_container

View file

@ -19,7 +19,7 @@ typedef AngelDeserializer<T> = T? Function(dynamic x);
/// Represents an Angel server that we are querying. /// Represents an Angel server that we are querying.
abstract class Angel extends http.BaseClient { abstract class Angel extends http.BaseClient {
final _log = Logger('Angel'); //final _log = Logger('Angel');
/// A mutable member. When this is set, it holds a JSON Web Token /// A mutable member. When this is set, it holds a JSON Web Token
/// that is automatically attached to every request sent. /// that is automatically attached to every request sent.

View file

@ -1,16 +1,27 @@
# 3.0.2 # Change Log
## 3.1.0
* Updated linter to `package:lints`
## 3.0.2
* Resolved static analysis warnings * Resolved static analysis warnings
# 3.0.1 ## 3.0.1
* Updated README * Updated README
# 3.0.0 ## 3.0.0
* Migrated to support Dart SDK 2.12.x NNBD * Migrated to support Dart SDK 2.12.x NNBD
# 2.0.0 ## 2.0.0
* Migrated to work with Dart SDK 2.12.x Non NNBD * Migrated to work with Dart SDK 2.12.x Non NNBD
# 1.1.0 ## 1.1.0
* `pedantic` lints. * `pedantic` lints.
* Add `ThrowingReflector`, which throws on all operations. * Add `ThrowingReflector`, which throws on all operations.
* `EmptyReflector` uses `Object` instead of `dynamic` as its returned * `EmptyReflector` uses `Object` instead of `dynamic` as its returned
@ -18,60 +29,77 @@ type, as the `dynamic` type is (apparently?) no longer a valid constant value.
* `registerSingleton` now returns the provided `object`. * `registerSingleton` now returns the provided `object`.
* `registerFactory` and `registerLazySingleton` now return the provided function `f`. * `registerFactory` and `registerLazySingleton` now return the provided function `f`.
# 1.0.4 ## 1.0.4
* Slight patch to prevent annoying segfault. * Slight patch to prevent annoying segfault.
# 1.0.3 ## 1.0.3
* Added `Future` support to `Reflector`. * Added `Future` support to `Reflector`.
# 1.0.2 ## 1.0.2
* Added `makeAsync<T>`. * Added `makeAsync<T>`.
# 1.0.1 ## 1.0.1
* Added `hasNamed`. * Added `hasNamed`.
# 1.0.0 ## 1.0.0
* Removed `@GenerateReflector`. * Removed `@GenerateReflector`.
# 1.0.0-alpha.12 ## 1.0.0-alpha.12
* `StaticReflector` now defaults to empty arguments. * `StaticReflector` now defaults to empty arguments.
# 1.0.0-alpha.11 ## 1.0.0-alpha.11
* Added `StaticReflector`. * Added `StaticReflector`.
# 1.0.0-alpha.10 ## 1.0.0-alpha.10
* Added `Container.registerLazySingleton<T>`. * Added `Container.registerLazySingleton<T>`.
* Added named singleton support. * Added named singleton support.
# 1.0.0-alpha.9 ## 1.0.0-alpha.9
* Added `Container.has<T>`. * Added `Container.has<T>`.
# 1.0.0-alpha.8 ## 1.0.0-alpha.8
* Fixed a bug where `_ReflectedTypeInstance.isAssignableTo` always failed. * Fixed a bug where `_ReflectedTypeInstance.isAssignableTo` always failed.
* Added `@GenerateReflector` annotation. * Added `@GenerateReflector` annotation.
# 1.0.0-alpha.7 ## 1.0.0-alpha.7
* Add `EmptyReflector`. * Add `EmptyReflector`.
* `ReflectedType.newInstance` now returns a `ReflectedInstance`. * `ReflectedType.newInstance` now returns a `ReflectedInstance`.
* Moved `ReflectedInstance.invoke` to `ReflectedFunction.invoke`. * Moved `ReflectedInstance.invoke` to `ReflectedFunction.invoke`.
# 1.0.0-alpha.6 ## 1.0.0-alpha.6
* Add `getField` to `ReflectedInstance`. * Add `getField` to `ReflectedInstance`.
# 1.0.0-alpha.5 ## 1.0.0-alpha.5
* Remove concrete type from `ReflectedTypeParameter`. * Remove concrete type from `ReflectedTypeParameter`.
# 1.0.0-alpha.4 ## 1.0.0-alpha.4
* Safely handle `void` return types of methods. * Safely handle `void` return types of methods.
# 1.0.0-alpha.3 ## 1.0.0-alpha.3
* Reflecting `void` in `MirrorsReflector` now forwards to `dynamic`. * Reflecting `void` in `MirrorsReflector` now forwards to `dynamic`.
# 1.0.0-alpha.2 ## 1.0.0-alpha.2
* Added `ReflectedInstance.reflectee`. * Added `ReflectedInstance.reflectee`.
# 1.0.0-alpha.1 ## 1.0.0-alpha.1
* Allow omission of the first argument of `Container.make`, to use * Allow omission of the first argument of `Container.make`, to use
a generic type argument instead. a generic type argument instead.
* `singleton` -> `registerSingleton` * `singleton` -> `registerSingleton`
* Add `createChild`, and support hierarchical containers. * Add `createChild`, and support hierarchical containers.

View file

@ -1,21 +1,29 @@
MIT License (MIT) BSD 3-Clause License
Copyright (c) 2021 dukefirehawk.com Copyright (c) 2021, dukefirehawk.com
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy Redistribution and use in source and binary forms, with or without
of this software and associated documentation files (the "Software"), to deal modification, are permitted provided that the following conditions are met:
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all 1. Redistributions of source code must retain the above copyright notice, this
copies or substantial portions of the Software. list of conditions and the following disclaimer.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2. Redistributions in binary form must reproduce the above copyright notice,
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, this list of conditions and the following disclaimer in the documentation
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE and/or other materials provided with the distribution.
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3. Neither the name of the copyright holder nor the names of its
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE contributors may be used to endorse or promote products derived from
SOFTWARE. this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -1,12 +1,12 @@
# angel3_container # Angel3 Container
[![version](https://img.shields.io/badge/pub-v3.0.2-brightgreen)](https://pub.dartlang.org/packages/angel3_container)
![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_container?include_prereleases)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion) [![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/master/packages/container/angel_container/LICENSE)
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/container/angel_container/LICENSE) A better IoC container for Angel3, ultimately allowing Angel3 to be used without dart:mirrors.
A better IoC container for Angel, ultimately allowing Angel to be used without dart:mirrors.
```dart ```dart
import 'package:angel3_container/angel3_container.dart'; import 'package:angel3_container/angel3_container.dart';
``` ```

View file

@ -1,4 +1 @@
include: package:pedantic/analysis_options.yaml include: package:lints/recommended.yaml
analyzer:
strong-mode:
implicit-casts: false

View file

@ -17,27 +17,27 @@ Future<void> main() async {
// Register a factory that creates a truck. // Register a factory that creates a truck.
container.registerFactory<Truck>((container) { container.registerFactory<Truck>((container) {
return _TruckImpl(container.make<Engine>()); return _TruckImpl(container.make<Engine>()!);
}); });
// Use `make` to create an instance. // Use `make` to create an instance.
var truck = container.make<Truck>()!; var truck = container.make<Truck>();
// You can also resolve injections asynchronously. // You can also resolve injections asynchronously.
container.registerFactory<Future<int>>((_) async => 24); container.registerFactory<Future<int>>((_) async => 24);
print(await container.makeAsync<int>()); print(await container.makeAsync<int>());
// Asynchronous resolution also works for plain objects. // Asynchronous resolution also works for plain objects.
await container.makeAsync<Truck>()!.then((t) => t.drive()); await container.makeAsync<Truck>()?.then((t) => t.drive());
// Register a named singleton. // Register a named singleton.
container.registerNamedSingleton('the_truck', truck); container.registerNamedSingleton('the_truck', truck);
// Should print: 'Vroom! I have 40 horsepower in my engine.' // Should print: 'Vroom! I have 40 horsepower in my engine.'
truck.drive(); truck?.drive();
// Should print the same. // Should print the same.
container.findByName<Truck>('the_truck')!.drive(); container.findByName<Truck>('the_truck')?.drive();
// We can make a child container with its own factory. // We can make a child container with its own factory.
var childContainer = container.createChild(); var childContainer = container.createChild();
@ -47,10 +47,10 @@ Future<void> main() async {
}); });
// Make a truck with 5666 HP. // Make a truck with 5666 HP.
childContainer.make<Truck>()!.drive(); childContainer.make<Truck>()?.drive();
// However, calling `make<Engine>` will return the Engine singleton we created above. // However, calling `make<Engine>` will return the Engine singleton we created above.
print(childContainer.make<Engine>()!.horsePower); print(childContainer.make<Engine>()?.horsePower);
} }
abstract class Truck { abstract class Truck {
@ -64,12 +64,12 @@ class Engine {
} }
class _TruckImpl implements Truck { class _TruckImpl implements Truck {
final Engine? engine; final Engine engine;
_TruckImpl(this.engine); _TruckImpl(this.engine);
@override @override
void drive() { void drive() {
print('Vroom! I have ${engine!.horsePower} horsepower in my engine.'); print('Vroom! I have ${engine.horsePower} horsepower in my engine.');
} }
} }

View file

@ -1,12 +1,13 @@
name: angel3_container name: angel3_container
version: 3.0.2 version: 3.1.0
description: A hierarchical DI container, and pluggable backends for reflection. description: A hierarchical DI container, and pluggable backends for reflection.
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/container/angel_container homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/master/packages/container/angel_container
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'
dependencies: dependencies:
collection: ^1.15.0 collection: ^1.15.0
quiver: ^3.0.1 quiver: ^3.0.1
dev_dependencies: dev_dependencies:
pedantic: ^1.11.0 test: ^1.17.5
test: ^1.17.4 lints: ^1.0.0

View file

@ -1,2 +1,15 @@
# 1.0.1 # Change Log
* Update for `pkg:angel_container@1.0.3`.
## 3.0.0-beta.1
* Migrated to support Dart SDK 2.12.x NNBD
* Updated linter to `package:lints`
* Updated to use `angel3_` packages
## 2.0.0
* Migrated to work with Dart SDK 2.12.x Non NNBD
## 1.0.1
* Update for `pkg:angel_container@1.0.3`.

View file

@ -1,21 +1,29 @@
MIT License (MIT) BSD 3-Clause License
Copyright (c) 2021 dukefirehawk.com Copyright (c) 2021, dukefirehawk.com
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy Redistribution and use in source and binary forms, with or without
of this software and associated documentation files (the "Software"), to deal modification, are permitted provided that the following conditions are met:
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all 1. Redistributions of source code must retain the above copyright notice, this
copies or substantial portions of the Software. list of conditions and the following disclaimer.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2. Redistributions in binary form must reproduce the above copyright notice,
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, this list of conditions and the following disclaimer in the documentation
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE and/or other materials provided with the distribution.
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3. Neither the name of the copyright holder nor the names of its
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE contributors may be used to endorse or promote products derived from
SOFTWARE. this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -1,2 +1,8 @@
# container # Angel3 Container Generator
A better IoC container for Angel, ultimately allowing Angel to be used without dart:mirrors.
![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_container_generator?include_prereleases)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/master/packages/container/angel3_container_generator/LICENSE)
A better IoC container for Angel3, ultimately allowing Angel3 to be used without `dart:mirrors`.

View file

@ -1,3 +1 @@
analyzer: include: package:lints/recommended.yaml
#strong-mode:
#implicit-casts: false

View file

@ -0,0 +1,76 @@
import 'dart:async';
import 'package:angel3_container/angel3_container.dart';
import 'package:angel3_container_generator/angel3_container_generator.dart';
Future<void> main() async {
// Create a container instance.
var reflector = const GeneratedReflector();
Container container = Container(reflector);
// Register a singleton.
container.registerSingleton<Engine>(Engine(40));
// You can also omit the type annotation, in which the object's runtime type will be used.
// If you're injecting an abstract class, prefer the type annotation.
//
// container.registerSingleton(Engine(40));
// Register a factory that creates a truck.
container.registerFactory<Truck>((container) {
return _TruckImpl(container.make<Engine>()!);
});
// Use `make` to create an instance.
var truck = container.make<Truck>();
// You can also resolve injections asynchronously.
container.registerFactory<Future<int>>((_) async => 24);
print(await container.makeAsync<int>());
// Asynchronous resolution also works for plain objects.
await container.makeAsync<Truck>()?.then((t) => t.drive());
// Register a named singleton.
container.registerNamedSingleton('the_truck', truck);
// Should print: 'Vroom! I have 40 horsepower in my engine.'
truck?.drive();
// Should print the same.
container.findByName<Truck>('the_truck')?.drive();
// We can make a child container with its own factory.
var childContainer = container.createChild();
childContainer.registerFactory<Truck>((container) {
return _TruckImpl(Engine(5666));
});
// Make a truck with 5666 HP.
childContainer.make<Truck>()?.drive();
// However, calling `make<Engine>` will return the Engine singleton we created above.
print(childContainer.make<Engine>()?.horsePower);
}
abstract class Truck {
void drive();
}
class Engine {
final int horsePower;
Engine(this.horsePower);
}
class _TruckImpl implements Truck {
final Engine engine;
_TruckImpl(this.engine);
@override
void drive() {
print('Vroom! I have ${engine.horsePower} horsepower in my engine.');
}
}

View file

@ -1,8 +1,8 @@
import 'package:angel_container/angel_container.dart'; import 'package:angel3_container/angel3_container.dart';
import 'package:reflectable/reflectable.dart'; import 'package:reflectable/reflectable.dart';
/// A [Reflectable] instance that can be used as an annotation on types to generate metadata for them. /// A [Reflectable] instance that can be used as an annotation on types to generate metadata for them.
const Reflectable contained = const ContainedReflectable(); const Reflectable contained = ContainedReflectable();
@contained @contained
class ContainedReflectable extends Reflectable { class ContainedReflectable extends Reflectable {
@ -38,37 +38,37 @@ class GeneratedReflector extends Reflector {
@override @override
ReflectedFunction reflectFunction(Function function) { ReflectedFunction reflectFunction(Function function) {
if (!reflectable.canReflect(function)) { if (!reflectable.canReflect(function)) {
throw new UnsupportedError('Cannot reflect $function.'); throw UnsupportedError('Cannot reflect $function.');
} }
var mirror = reflectable.reflect(function); var mirror = reflectable.reflect(function);
if (mirror is ClosureMirror) { if (mirror is ClosureMirror) {
return new _GeneratedReflectedFunction(mirror.function, this, mirror); return _GeneratedReflectedFunction(mirror.function, this, mirror);
} else { } else {
throw new ArgumentError('$function is not a Function.'); throw ArgumentError('$function is not a Function.');
} }
} }
@override @override
ReflectedInstance reflectInstance(Object object) { ReflectedInstance reflectInstance(Object object) {
if (!reflectable.canReflect(object)) { if (!reflectable.canReflect(object)) {
throw new UnsupportedError('Cannot reflect $object.'); throw UnsupportedError('Cannot reflect $object.');
} else { } else {
var mirror = reflectable.reflect(object); var mirror = reflectable.reflect(object);
return new _GeneratedReflectedInstance(mirror, this); return _GeneratedReflectedInstance(mirror, this);
} }
} }
@override @override
ReflectedType reflectType(Type type) { ReflectedType reflectType(Type type) {
if (!reflectable.canReflectType(type)) { if (!reflectable.canReflectType(type)) {
throw new UnsupportedError('Cannot reflect $type.'); throw UnsupportedError('Cannot reflect $type.');
} else { } else {
var mirror = reflectable.reflectType(type); var mirror = reflectable.reflectType(type);
return mirror is ClassMirror return mirror is ClassMirror
? new _GeneratedReflectedClass(mirror, this) ? _GeneratedReflectedClass(mirror, this)
: new _GeneratedReflectedType(mirror); : _GeneratedReflectedType(mirror);
} }
} }
} }
@ -78,17 +78,17 @@ class _GeneratedReflectedInstance extends ReflectedInstance {
final GeneratedReflector reflector; final GeneratedReflector reflector;
_GeneratedReflectedInstance(this.mirror, this.reflector) _GeneratedReflectedInstance(this.mirror, this.reflector)
: super(null, new _GeneratedReflectedClass(mirror.type, reflector), : super(_GeneratedReflectedType(mirror.type),
mirror.reflectee); _GeneratedReflectedClass(mirror.type, reflector), mirror.reflectee);
@override @override
ReflectedType get type => clazz; ReflectedType get type => clazz;
@override @override
ReflectedInstance getField(String name) { ReflectedInstance getField(String name) {
var result = mirror.invokeGetter(name); var result = mirror.invokeGetter(name)!;
var instance = reflector.reflectable.reflect(result); var instance = reflector.reflectable.reflect(result);
return new _GeneratedReflectedInstance(instance, reflector); return _GeneratedReflectedInstance(instance, reflector);
} }
} }
@ -97,7 +97,7 @@ class _GeneratedReflectedClass extends ReflectedClass {
final Reflector reflector; final Reflector reflector;
_GeneratedReflectedClass(this.mirror, this.reflector) _GeneratedReflectedClass(this.mirror, this.reflector)
: super(mirror.simpleName, null, null, null, null, mirror.reflectedType); : super(mirror.simpleName, [], [], [], [], mirror.reflectedType);
@override @override
List<ReflectedTypeParameter> get typeParameters => List<ReflectedTypeParameter> get typeParameters =>
@ -112,11 +112,13 @@ class _GeneratedReflectedClass extends ReflectedClass {
_declarationsOf(mirror.declarations, reflector); _declarationsOf(mirror.declarations, reflector);
@override @override
List<ReflectedInstance> get annotations => List<ReflectedInstance> get annotations => mirror.metadata
mirror.metadata.map(reflector.reflectInstance).toList(); .map(reflector.reflectInstance)
.whereType<ReflectedInstance>()
.toList();
@override @override
bool isAssignableTo(ReflectedType other) { bool isAssignableTo(ReflectedType? other) {
if (other is _GeneratedReflectedClass) { if (other is _GeneratedReflectedClass) {
return mirror.isAssignableTo(other.mirror); return mirror.isAssignableTo(other.mirror);
} else if (other is _GeneratedReflectedType) { } else if (other is _GeneratedReflectedType) {
@ -129,11 +131,11 @@ class _GeneratedReflectedClass extends ReflectedClass {
@override @override
ReflectedInstance newInstance( ReflectedInstance newInstance(
String constructorName, List positionalArguments, String constructorName, List positionalArguments,
[Map<String, dynamic> namedArguments, List<Type> typeArguments]) { [Map<String, dynamic>? namedArguments, List<Type>? typeArguments]) {
namedArguments ??= {}; namedArguments ??= {};
var result = mirror.newInstance(constructorName, positionalArguments, var result = mirror.newInstance(constructorName, positionalArguments,
namedArguments.map((k, v) => new MapEntry(new Symbol(k), v))); namedArguments.map((k, v) => MapEntry(Symbol(k), v)));
return reflector.reflectInstance(result); return reflector.reflectInstance(result)!;
} }
} }
@ -141,14 +143,14 @@ class _GeneratedReflectedType extends ReflectedType {
final TypeMirror mirror; final TypeMirror mirror;
_GeneratedReflectedType(this.mirror) _GeneratedReflectedType(this.mirror)
: super(mirror.simpleName, null, mirror.reflectedType); : super(mirror.simpleName, [], mirror.reflectedType);
@override @override
List<ReflectedTypeParameter> get typeParameters => List<ReflectedTypeParameter> get typeParameters =>
mirror.typeVariables.map(_convertTypeVariable).toList(); mirror.typeVariables.map(_convertTypeVariable).toList();
@override @override
bool isAssignableTo(ReflectedType other) { bool isAssignableTo(ReflectedType? other) {
if (other is _GeneratedReflectedClass) { if (other is _GeneratedReflectedClass) {
return mirror.isAssignableTo(other.mirror); return mirror.isAssignableTo(other.mirror);
} else if (other is _GeneratedReflectedType) { } else if (other is _GeneratedReflectedType) {
@ -161,25 +163,27 @@ class _GeneratedReflectedType extends ReflectedType {
@override @override
ReflectedInstance newInstance( ReflectedInstance newInstance(
String constructorName, List positionalArguments, String constructorName, List positionalArguments,
[Map<String, dynamic> namedArguments, List<Type> typeArguments]) { [Map<String, dynamic>? namedArguments, List<Type>? typeArguments]) {
throw new UnsupportedError( throw UnsupportedError('Cannot create a new instance of $reflectedType.');
'Cannot create a new instance of $reflectedType.');
} }
} }
class _GeneratedReflectedFunction extends ReflectedFunction { class _GeneratedReflectedFunction extends ReflectedFunction {
final MethodMirror mirror; final MethodMirror mirror;
final Reflector reflector; final Reflector reflector;
final ClosureMirror closure; final ClosureMirror? closure;
_GeneratedReflectedFunction(this.mirror, this.reflector, [this.closure]) _GeneratedReflectedFunction(this.mirror, this.reflector, [this.closure])
: super( : super(
mirror.simpleName, mirror.simpleName,
[], [],
null, [],
/*
!mirror.isRegularMethod !mirror.isRegularMethod
? null ? null
: new _GeneratedReflectedType(mirror.returnType), : _GeneratedReflectedType(mirror.returnType),
*/
_GeneratedReflectedType(mirror.returnType),
mirror.parameters mirror.parameters
.map((p) => _convertParameter(p, reflector)) .map((p) => _convertParameter(p, reflector))
.toList(), .toList(),
@ -187,16 +191,18 @@ class _GeneratedReflectedFunction extends ReflectedFunction {
mirror.isSetter); mirror.isSetter);
@override @override
List<ReflectedInstance> get annotations => List<ReflectedInstance> get annotations => mirror.metadata
mirror.metadata.map(reflector.reflectInstance).toList(); .map(reflector.reflectInstance)
.whereType<ReflectedInstance>()
.toList();
@override @override
ReflectedInstance invoke(Invocation invocation) { ReflectedInstance invoke(Invocation invocation) {
if (closure != null) { if (closure != null) {
throw new UnsupportedError('Only closures can be invoked directly.'); throw UnsupportedError('Only closures can be invoked directly.');
} else { } else {
var result = closure.delegate(invocation); var result = closure!.delegate(invocation)!;
return reflector.reflectInstance(result); return reflector.reflectInstance(result)!;
} }
} }
} }
@ -207,7 +213,7 @@ List<ReflectedFunction> _constructorsOf(
var v = entry.value; var v = entry.value;
if (v is MethodMirror && v.isConstructor) { if (v is MethodMirror && v.isConstructor) {
return out..add(new _GeneratedReflectedFunction(v, reflector)); return out..add(_GeneratedReflectedFunction(v, reflector));
} else { } else {
return out; return out;
} }
@ -220,12 +226,12 @@ List<ReflectedDeclaration> _declarationsOf(
var v = entry.value; var v = entry.value;
if (v is VariableMirror) { if (v is VariableMirror) {
var decl = new ReflectedDeclaration(v.simpleName, v.isStatic, null); var decl = ReflectedDeclaration(v.simpleName, v.isStatic, null);
return out..add(decl); return out..add(decl);
} }
if (v is MethodMirror) { if (v is MethodMirror) {
var decl = new ReflectedDeclaration(v.simpleName, v.isStatic, var decl = ReflectedDeclaration(
new _GeneratedReflectedFunction(v, reflector)); v.simpleName, v.isStatic, _GeneratedReflectedFunction(v, reflector));
return out..add(decl); return out..add(decl);
} else { } else {
return out; return out;
@ -234,15 +240,16 @@ List<ReflectedDeclaration> _declarationsOf(
} }
ReflectedTypeParameter _convertTypeVariable(TypeVariableMirror mirror) { ReflectedTypeParameter _convertTypeVariable(TypeVariableMirror mirror) {
return new ReflectedTypeParameter(mirror.simpleName); return ReflectedTypeParameter(mirror.simpleName);
} }
ReflectedParameter _convertParameter( ReflectedParameter _convertParameter(
ParameterMirror mirror, Reflector reflector) { ParameterMirror mirror, Reflector reflector) {
return new ReflectedParameter( return ReflectedParameter(
mirror.simpleName, mirror.simpleName,
mirror.metadata.map(reflector.reflectInstance).toList(), mirror.metadata.map(reflector.reflectInstance).toList()
reflector.reflectType(mirror.type.reflectedType), as List<ReflectedInstance>,
reflector.reflectType(mirror.type.reflectedType)!,
!mirror.isOptional, !mirror.isOptional,
mirror.isNamed); mirror.isNamed);
} }

View file

@ -1,18 +1,19 @@
name: angel_container_generator name: angel3_container_generator
version: 2.0.0 version: 3.0.0-beta.1
description: Codegen support for using pkg:reflectable with pkg:angel_container. description: Codegen support for using pkg:reflectable with pkg:angel3_container.
homepage: https://github.com/angel-dart/container.git homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/master/packages/container/angel_container_generator
publish_to: none publish_to: none
environment: environment:
sdk: ">=2.10.0 <3.0.0" sdk: '>=2.12.0 <3.0.0'
dependencies: dependencies:
angel_container: angel3_container: ^3.1.0
git: reflectable: ^3.0.4
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x
path: packages/container/angel_container
reflectable: ^2.2.9
dev_dependencies: dev_dependencies:
build_runner: ^1.11.1 build_runner: ^2.1.2
build_test: ^1.3.6 build_test: ^2.1.3
test: ^1.16.5 test: ^1.17.5
lints: ^1.0.1
dependency_overrides:
angel3_container:
path: ../angel_container

View file

@ -1,5 +1,5 @@
import 'package:angel_container/angel_container.dart'; import 'package:angel3_container/angel3_container.dart';
import 'package:angel_container_generator/angel_container_generator.dart'; import 'package:angel3_container_generator/angel3_container_generator.dart';
@GlobalQuantifyCapability( @GlobalQuantifyCapability(
r'^dart\.core\.(Iterable|List|String|int|Object)', contained) r'^dart\.core\.(Iterable|List|String|int|Object)', contained)
@ -11,11 +11,11 @@ import 'reflector_test.reflectable.dart';
void main() { void main() {
initializeReflectable(); initializeReflectable();
var reflector = const GeneratedReflector(); var reflector = const GeneratedReflector();
Container container; late Container container;
setUp(() { setUp(() {
container = new Container(reflector); container = Container(reflector);
container.registerSingleton(new Artist(name: 'Stevie Wonder')); container.registerSingleton(Artist(name: 'Stevie Wonder'));
}); });
group('reflectClass', () { group('reflectClass', () {
@ -27,7 +27,7 @@ void main() {
}); });
test('inject constructor parameters', () { test('inject constructor parameters', () {
var album = container.make<Album>(); var album = container.make<Album>()!;
print(album.title); print(album.title);
expect(album.title, 'flowers by stevie wonder'); expect(album.title, 'flowers by stevie wonder');
}); });
@ -39,16 +39,16 @@ void main() {
void returnVoidFromAFunction(int x) {} void returnVoidFromAFunction(int x) {}
void testReflector(Reflector reflector) { void testReflector(Reflector reflector) {
var blaziken = new Pokemon('Blaziken', PokemonType.fire); var blaziken = Pokemon('Blaziken', PokemonType.fire);
Container container; late Container container;
setUp(() { setUp(() {
container = new Container(reflector); container = Container(reflector);
container.registerSingleton(blaziken); container.registerSingleton(blaziken);
}); });
test('get field', () { test('get field', () {
var blazikenMirror = reflector.reflectInstance(blaziken); var blazikenMirror = reflector.reflectInstance(blaziken)!;
expect(blazikenMirror.getField('type').reflectee, blaziken.type); expect(blazikenMirror.getField('type').reflectee, blaziken.type);
}); });
@ -93,12 +93,12 @@ void testReflector(Reflector reflector) {
}); });
test('constructor injects singleton', () { test('constructor injects singleton', () {
var lower = container.make<LowerPokemon>(); var lower = container.make<LowerPokemon>()!;
expect(lower.lowercaseName, blaziken.name.toLowerCase()); expect(lower.lowercaseName, blaziken.name.toLowerCase());
}); });
test('newInstance works', () { test('newInstance works', () {
var type = container.reflector.reflectType(Pokemon); var type = container.reflector.reflectType(Pokemon)!;
var instance = var instance =
type.newInstance('changeName', [blaziken, 'Charizard']).reflectee type.newInstance('changeName', [blaziken, 'Charizard']).reflectee
as Pokemon; as Pokemon;
@ -109,7 +109,7 @@ void testReflector(Reflector reflector) {
test('isAssignableTo', () { test('isAssignableTo', () {
var pokemonType = container.reflector.reflectType(Pokemon); var pokemonType = container.reflector.reflectType(Pokemon);
var kantoPokemonType = container.reflector.reflectType(KantoPokemon); var kantoPokemonType = container.reflector.reflectType(KantoPokemon)!;
expect(kantoPokemonType.isAssignableTo(pokemonType), true); expect(kantoPokemonType.isAssignableTo(pokemonType), true);
expect( expect(
@ -136,7 +136,7 @@ class Pokemon {
Pokemon(this.name, this.type); Pokemon(this.name, this.type);
factory Pokemon.changeName(Pokemon other, String name) { factory Pokemon.changeName(Pokemon other, String name) {
return new Pokemon(name, other.type); return Pokemon(name, other.type);
} }
@override @override
@ -153,12 +153,12 @@ enum PokemonType { water, fire, grass, ice, poison, flying }
@contained @contained
class Artist { class Artist {
final String name; final String? name;
Artist({this.name}); Artist({this.name});
String get lowerName { String get lowerName {
return name.toLowerCase(); return name!.toLowerCase();
} }
} }
@ -178,5 +178,5 @@ class AlbumLength {
AlbumLength(this.artist, this.album); AlbumLength(this.artist, this.album);
int get totalLength => artist.name.length + album.title.length; int get totalLength => artist.name!.length + album.title.length;
} }

View file

@ -3,7 +3,7 @@
import "dart:core"; import "dart:core";
import 'dart:math' as prefix4; import 'dart:math' as prefix4;
import 'package:angel_container_generator/angel_container_generator.dart' import 'package:angel3_container_generator/angel3_container_generator.dart'
as prefix0; as prefix0;
import 'package:reflectable/capability.dart' as prefix2; import 'package:reflectable/capability.dart' as prefix2;
import 'package:reflectable/mirrors.dart' as prefix3; import 'package:reflectable/mirrors.dart' as prefix3;
@ -395,13 +395,13 @@ final _data = <r.Reflectable, r.ReflectorData>{
? (length == null ? [] : [] ? (length == null ? [] : []
..length) ..length)
: null, : null,
r"filled": (b) => (length, fill, {growable: false}) => r"filled": (b) => (length, fill, {growable = false}) =>
b ? List.filled(length, fill, growable: growable) : null, b ? List.filled(length, fill, growable: growable) : null,
r"from": (b) => (elements, {growable: true}) => r"from": (b) => (elements, {growable = true}) =>
b ? List.from(elements, growable: growable) : null, b ? List.from(elements, growable: growable) : null,
r"of": (b) => (elements, {growable: true}) => r"of": (b) => (elements, {growable = true}) =>
b ? List.of(elements, growable: growable) : null, b ? List.of(elements, growable: growable) : null,
r"generate": (b) => (length, generator, {growable: true}) => b r"generate": (b) => (length, generator, {growable = true}) => b
? List.generate(length, generator, growable: growable) ? List.generate(length, generator, growable: growable)
: null, : null,
r"unmodifiable": (b) => r"unmodifiable": (b) =>
@ -431,7 +431,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
-1, -1,
11, 11,
const <int>[], const <int>[],
const <Object>[const pragma("vm:entry-point")], const <Object>[pragma("vm:entry-point")],
null), null),
r.NonGenericClassMirrorImpl( r.NonGenericClassMirrorImpl(
r"String", r"String",
@ -717,13 +717,13 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"noSuchMethod", r"noSuchMethod",
65538, 65538,
11, 11,
null, 0,
null, 0,
null, 0,
const <int>[], const <int>[],
const <int>[2], const <int>[2],
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
const <Object>[const pragma("vm:entry-point")]), const <Object>[pragma("vm:entry-point")]),
r.MethodMirrorImpl( r.MethodMirrorImpl(
r"hashCode", r"hashCode",
131075, 131075,
@ -915,7 +915,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r.MethodMirrorImpl( r.MethodMirrorImpl(
r"capabilities", r"capabilities",
4325379, 4325379,
null, 0,
10, 10,
19, 19,
10, 10,
@ -926,7 +926,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r.MethodMirrorImpl( r.MethodMirrorImpl(
r"canReflect", r"canReflect",
131074, 131074,
null, 0,
-1, -1,
16, 16,
16, 16,
@ -937,7 +937,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r.MethodMirrorImpl( r.MethodMirrorImpl(
r"reflect", r"reflect",
131074, 131074,
null, 0,
-1, -1,
20, 20,
20, 20,
@ -948,7 +948,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r.MethodMirrorImpl( r.MethodMirrorImpl(
r"canReflectType", r"canReflectType",
131074, 131074,
null, 0,
-1, -1,
16, 16,
16, 16,
@ -959,7 +959,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r.MethodMirrorImpl( r.MethodMirrorImpl(
r"reflectType", r"reflectType",
131074, 131074,
null, 0,
-1, -1,
21, 21,
21, 21,
@ -970,7 +970,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r.MethodMirrorImpl( r.MethodMirrorImpl(
r"findLibrary", r"findLibrary",
131074, 131074,
null, 0,
-1, -1,
22, 22,
22, 22,
@ -981,7 +981,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r.MethodMirrorImpl( r.MethodMirrorImpl(
r"libraries", r"libraries",
4325379, 4325379,
null, 0,
-1, -1,
24, 24,
25, 25,
@ -992,7 +992,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r.MethodMirrorImpl( r.MethodMirrorImpl(
r"annotatedClasses", r"annotatedClasses",
4325379, 4325379,
null, 0,
9, 9,
27, 27,
9, 9,
@ -1404,7 +1404,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"forEach", r"forEach",
262146, 262146,
9, 9,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1676,7 +1676,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"copyRange", r"copyRange",
262162, 262162,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1687,7 +1687,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"writeIterable", r"writeIterable",
262162, 262162,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1720,7 +1720,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"[]=", r"[]=",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1731,7 +1731,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"add", r"add",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1742,7 +1742,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"addAll", r"addAll",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1753,7 +1753,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"sort", r"sort",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1764,7 +1764,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"shuffle", r"shuffle",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1819,7 +1819,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"clear", r"clear",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1830,7 +1830,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"insert", r"insert",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1841,7 +1841,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"insertAll", r"insertAll",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1852,7 +1852,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"setAll", r"setAll",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1896,7 +1896,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"removeWhere", r"removeWhere",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1907,7 +1907,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"retainWhere", r"retainWhere",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1942,7 +1942,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"setRange", r"setRange",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1953,7 +1953,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"removeRange", r"removeRange",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1964,7 +1964,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"fillRange", r"fillRange",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1975,7 +1975,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"replaceRange", r"replaceRange",
262658, 262658,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -1997,7 +1997,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"first=", r"first=",
262660, 262660,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -2008,7 +2008,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"last=", r"last=",
262660, 262660,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -2030,7 +2030,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"length=", r"length=",
262660, 262660,
10, 10,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -2505,7 +2505,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"write", r"write",
262146, 262146,
13, 13,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -2516,7 +2516,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"writeCharCode", r"writeCharCode",
262146, 262146,
13, 13,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -2527,7 +2527,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"writeAll", r"writeAll",
262146, 262146,
13, 13,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -2538,7 +2538,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"writeln", r"writeln",
262146, 262146,
13, 13,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -2549,7 +2549,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"clear", r"clear",
262146, 262146,
13, 13,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -2615,7 +2615,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"write", r"write",
262658, 262658,
14, 14,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -2626,7 +2626,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"writeAll", r"writeAll",
262658, 262658,
14, 14,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -2637,7 +2637,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"writeln", r"writeln",
262658, 262658,
14, 14,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -2648,7 +2648,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
r"writeCharCode", r"writeCharCode",
262658, 262658,
14, 14,
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -2676,9 +2676,9 @@ final _data = <r.Reflectable, r.ReflectorData>{
16390, 16390,
18, 18,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
null, 0,
null, 0,
const <int>[], const <int>[],
const <Object>[], const <Object>[],
null, null,
@ -3048,7 +3048,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
12294, 12294,
80, 80,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
50, 50,
50, 50,
const <int>[], const <int>[],
@ -3128,13 +3128,13 @@ final _data = <r.Reflectable, r.ReflectorData>{
null, null,
null), null),
r.ParameterMirrorImpl(r"f", 6, 90, const prefix0.ContainedReflectable(), r.ParameterMirrorImpl(r"f", 6, 90, const prefix0.ContainedReflectable(),
null, 52, 52, null, const <Object>[], null, null), 0, 52, 52, null, const <Object>[], null, null),
r.ParameterMirrorImpl( r.ParameterMirrorImpl(
r"test", r"test",
6, 6,
91, 91,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
53, 53,
53, 53,
null, null,
@ -3142,7 +3142,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
null, null,
null), null),
r.ParameterMirrorImpl(r"f", 6, 93, const prefix0.ContainedReflectable(), r.ParameterMirrorImpl(r"f", 6, 93, const prefix0.ContainedReflectable(),
null, 54, 54, null, const <Object>[], null, null), 0, 54, 54, null, const <Object>[], null, null),
r.ParameterMirrorImpl( r.ParameterMirrorImpl(
r"element", r"element",
32774, 32774,
@ -3156,13 +3156,13 @@ final _data = <r.Reflectable, r.ReflectorData>{
null, null,
null), null),
r.ParameterMirrorImpl(r"f", 6, 95, const prefix0.ContainedReflectable(), r.ParameterMirrorImpl(r"f", 6, 95, const prefix0.ContainedReflectable(),
null, 55, 55, null, const <Object>[], null, null), 0, 55, 55, null, const <Object>[], null, null),
r.ParameterMirrorImpl( r.ParameterMirrorImpl(
r"combine", r"combine",
6, 6,
96, 96,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
56, 56,
56, 56,
null, null,
@ -3174,7 +3174,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
97, 97,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -3186,7 +3186,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
97, 97,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
57, 57,
57, 57,
null, null,
@ -3198,7 +3198,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
98, 98,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
53, 53,
53, 53,
null, null,
@ -3222,7 +3222,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
100, 100,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
53, 53,
53, 53,
null, null,
@ -3258,7 +3258,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
104, 104,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
53, 53,
53, 53,
null, null,
@ -3282,7 +3282,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
106, 106,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
53, 53,
53, 53,
null, null,
@ -3294,7 +3294,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
107, 107,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
53, 53,
53, 53,
null, null,
@ -3306,7 +3306,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
12294, 12294,
107, 107,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
58, 58,
58, 58,
null, null,
@ -3318,7 +3318,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
108, 108,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
53, 53,
53, 53,
null, null,
@ -3330,7 +3330,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
12294, 12294,
108, 108,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
58, 58,
58, 58,
null, null,
@ -3342,7 +3342,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
109, 109,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
53, 53,
53, 53,
null, null,
@ -3354,7 +3354,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
12294, 12294,
109, 109,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
58, 58,
58, 58,
null, null,
@ -3390,7 +3390,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
4102, 4102,
120, 120,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
59, 59,
59, 59,
null, null,
@ -3534,7 +3534,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
127, 127,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -3546,7 +3546,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
128, 128,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -3570,7 +3570,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
4102, 4102,
130, 130,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
64, 64,
64, 64,
null, null,
@ -3594,7 +3594,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
132, 132,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -3618,7 +3618,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
133, 133,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
66, 66,
66, 66,
null, null,
@ -3642,7 +3642,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
134, 134,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
66, 66,
66, 66,
null, null,
@ -3666,7 +3666,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
135, 135,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -3702,7 +3702,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
137, 137,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -3786,7 +3786,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
143, 143,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
66, 66,
66, 66,
null, null,
@ -3798,7 +3798,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
144, 144,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
66, 66,
66, 66,
null, null,
@ -3966,7 +3966,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
4102, 4102,
150, 150,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -4038,7 +4038,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
159, 159,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -4122,7 +4122,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
162, 162,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
68, 68,
68, 68,
null, null,
@ -4158,7 +4158,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
153, 153,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -4170,7 +4170,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
154, 154,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
-1, -1,
-1, -1,
const <int>[], const <int>[],
@ -4494,7 +4494,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
183, 183,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
70, 70,
70, 70,
const <int>[], const <int>[],
@ -4554,7 +4554,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
6, 6,
185, 185,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
70, 70,
70, 70,
const <int>[], const <int>[],
@ -4626,7 +4626,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
12294, 12294,
188, 188,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
70, 70,
70, 70,
const <int>[], const <int>[],
@ -4638,7 +4638,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
12294, 12294,
188, 188,
const prefix0.ContainedReflectable(), const prefix0.ContainedReflectable(),
null, 0,
71, 71,
71, 71,
const <int>[], const <int>[],
@ -4990,7 +4990,7 @@ final _data = <r.Reflectable, r.ReflectorData>{
[]) [])
}; };
final _memberSymbolMap = null; final dynamic _memberSymbolMap = null;
initializeReflectable() { initializeReflectable() {
r.data = _data; r.data = _data;

View file

@ -1,21 +1,23 @@
# angel3_json_god # angel3_json_god
[![version](https://img.shields.io/badge/pub-v4.0.3-brightgreen)](https://pub.dartlang.org/packages/angel3_json_god) [![version](https://img.shields.io/badge/pub-v4.0.3-brightgreen)](https://pub.dartlang.org/packages/angel3_json_god)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion) [![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/json_god/LICENSE) [![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/json_god/LICENSE)
**DEPRECATED: Replaced by [`belatuk_json_serializer`](https://pub.dartlang.org/packages/belatuk_json_serializer) package**
The ***new and improved*** definitive solution for JSON in Dart. It supports synchronously transform an object into a JSON string and also deserialize a JSON string back into an instance of any type. The ***new and improved*** definitive solution for JSON in Dart. It supports synchronously transform an object into a JSON string and also deserialize a JSON string back into an instance of any type.
## Installation
# Installation dependencies:
dependencies: angel3_json_god: ^4.0.0
angel3_json_god: ^4.0.0
# Usage ## Usage
It is recommended to import the library under an alias, i.e., `god`. It is recommended to import the library under an alias, i.e., `god`.
```dart ```dart
import 'package:angel3_json_god/angel3_json_god.dart' as god; import 'package:angel3_json_god/angel3_json_god.dart' as god;
@ -25,6 +27,7 @@ import 'package:angel3_json_god/angel3_json_god.dart' as god;
Simply call `god.serialize(x)` to synchronously transform an object into a JSON Simply call `god.serialize(x)` to synchronously transform an object into a JSON
string. string.
```dart ```dart
Map map = {"foo": "bar", "numbers": [1, 2, {"three": 4}]}; Map map = {"foo": "bar", "numbers": [1, 2, {"three": 4}]};
@ -34,6 +37,7 @@ print(json);
``` ```
You can easily serialize classes, too. JSON God also supports classes as members. You can easily serialize classes, too. JSON God also supports classes as members.
```dart ```dart
class A { class A {
@ -62,6 +66,7 @@ If a class has a `toJson` method, it will be called instead.
## Deserializing JSON ## Deserializing JSON
Deserialization is equally easy, and is provided through `god.deserialize`. Deserialization is equally easy, and is provided through `god.deserialize`.
```dart ```dart
Map map = god.deserialize('{"hello":"world"}'); Map map = god.deserialize('{"hello":"world"}');
int three = god.deserialize("3"); int three = god.deserialize("3");
@ -92,7 +97,7 @@ main() {
``` ```
**Any JSON-deserializable classes must initializable without parameters. **Any JSON-deserializable classes must initializable without parameters.
If ` Foo()` would throw an error, then you can't use Foo with JSON.** If `Foo()` would throw an error, then you can't use Foo with JSON.**
This allows for validation of a sort, as only fields you have declared will be This allows for validation of a sort, as only fields you have declared will be
accepted. accepted.
@ -105,4 +110,3 @@ HasAnInt invalid = god.deserialize('["some invalid input"]', HasAnInt);
``` ```
An exception will be thrown if validation fails. An exception will be thrown if validation fails.

View file

@ -1,5 +1,9 @@
# Change Log # Change Log
## 3.1.0
* Updated linter to `package:lints`
## 3.0.2 ## 3.0.2
* Updated README * Updated README

View file

@ -1,21 +1,29 @@
MIT License (MIT) BSD 3-Clause License
Copyright (c) 2021 dukefirehawk.com Copyright (c) 2021, dukefirehawk.com
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy Redistribution and use in source and binary forms, with or without
of this software and associated documentation files (the "Software"), to deal modification, are permitted provided that the following conditions are met:
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all 1. Redistributions of source code must retain the above copyright notice, this
copies or substantial portions of the Software. list of conditions and the following disclaimer.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2. Redistributions in binary form must reproduce the above copyright notice,
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, this list of conditions and the following disclaimer in the documentation
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE and/or other materials provided with the distribution.
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3. Neither the name of the copyright holder nor the names of its
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE contributors may be used to endorse or promote products derived from
SOFTWARE. this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -1,10 +1,9 @@
# Angel3 Basic Model # Angel3 Basic Data Model
[![version](https://img.shields.io/badge/pub-v3.0.2-brightgreen)](https://pub.dartlang.org/packages/angel3_model) ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_model?include_prereleases)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion) [![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/master/packages/model/LICENSE)
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/model/LICENSE)
Angel3 basic data model class, no longer with the added weight of the whole framework. Angel3 basic data model class, no longer with the added weight of the whole framework.

View file

@ -1,4 +1,2 @@
include: package:pedantic/analysis_options.yaml
analyzer: include: package:lints/recommended.yaml
strong-mode:
implicit-casts: false

View file

@ -1,9 +1,9 @@
name: angel3_model name: angel3_model
version: 3.0.2 version: 3.1.0
description: Angel3 basic data model class, no longer with the added weight of the whole framework. description: Angel3 basic data model class, no longer with the added weight of the whole framework.
homepage: https://angel3-framework.web.app/ homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/model repository: https://github.com/dukefirehawk/angel/tree/master/packages/model
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'
dev_dependencies: dev_dependencies:
pedantic: ^1.11.0 lints: ^1.0.0

View file

@ -7,7 +7,7 @@
## 3.0.0-dev.1 ## 3.0.0-dev.1
* Migrated to support Dart SDK 2.12.x NNBD * Migrated to support Dart SDK 2.12.x NNBD
* Upgraded from `pendantic` to `lints` linter * Updated linter to `package:lints`
## 2.1.0 ## 2.1.0