diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
deleted file mode 100644
index ce3081f..0000000
--- a/.github/FUNDING.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-# These are supported funding model platforms
-
-github: [thosakwe]
diff --git a/.gitignore b/.gitignore
index d88b0df..10938ad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,25 +37,7 @@ pubspec.lock
# User-specific stuff:
.idea/workspace.xml
-.idea/tasks.xml
-.idea/dictionaries
-.idea/vcs.xml
-.idea/jsLibraryMappings.xml
-# Sensitive or high-churn files:
-.idea/dataSources.ids
-.idea/dataSources.xml
-.idea/dataSources.local.xml
-.idea/sqlDataSources.xml
-.idea/dynamic.xml
-.idea/uiDesigner.xml
-
-# Gradle:
-.idea/gradle.xml
-.idea/libraries
-
-# Mongo Explorer plugin:
-.idea/mongoSettings.xml
## File-based project format:
*.iws
@@ -78,11 +60,8 @@ crashlytics-build.properties
fabric.properties
### VSCode template
-.vscode/*
-!.vscode/settings.json
-!.vscode/tasks.json
-!.vscode/launch.json
-!.vscode/extensions.json
+.vscode/
+.metals/
logs/
*.pem
diff --git a/.idea/angel.iml b/.idea/angel.iml
deleted file mode 100644
index eae1301..0000000
--- a/.idea/angel.iml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index c65900a..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- General
-
-
- XPath
-
-
-
-
- AngularJS
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index b034384..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/runConfigurations/dev_dart.xml b/.idea/runConfigurations/dev_dart.xml
deleted file mode 100644
index 418187f..0000000
--- a/.idea/runConfigurations/dev_dart.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/runConfigurations/prod_dart.xml b/.idea/runConfigurations/prod_dart.xml
deleted file mode 100644
index e93c56a..0000000
--- a/.idea/runConfigurations/prod_dart.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/bin/dev.dart b/bin/dev.dart
index e22cba9..93b255d 100644
--- a/bin/dev.dart
+++ b/bin/dev.dart
@@ -1,12 +1,12 @@
import 'dart:io';
-import 'package:angel/src/pretty_logging.dart';
+import 'package:pretty_logging/pretty_logging.dart';
import 'package:angel/angel.dart';
import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_hot/angel_hot.dart';
import 'package:logging/logging.dart';
-main() async {
+void main() async {
// Watch the config/ and web/ directories for changes, and hot-reload the server.
hierarchicalLoggingEnabled = true;
diff --git a/bin/prod.dart b/bin/prod.dart
index db0ec67..fb7de39 100644
--- a/bin/prod.dart
+++ b/bin/prod.dart
@@ -25,6 +25,6 @@ import 'package:angel_production/angel_production.dart';
// so in the meantime, visit the Angel chat for further questions:
//
// https://gitter.im/angel_dart/discussion
-main(List args) =>
+void main(List args) =>
Runner('{{angel}}', configureServer, reflector: MirrorsReflector())
.run(args);
diff --git a/lib/src/models/todo.dart b/lib/src/models/todo.dart
index 6c9bf89..f3f0242 100644
--- a/lib/src/models/todo.dart
+++ b/lib/src/models/todo.dart
@@ -5,7 +5,7 @@ part 'todo.g.dart';
@graphQLClass
@serializable
abstract class _Todo extends Model {
- String get text;
+ String? get text;
- bool get isComplete;
+ bool? get isComplete;
}
diff --git a/lib/src/models/todo.g.dart b/lib/src/models/todo.g.dart
index 42afe52..5541b0b 100644
--- a/lib/src/models/todo.g.dart
+++ b/lib/src/models/todo.g.dart
@@ -11,26 +11,26 @@ class Todo extends _Todo {
Todo({this.id, this.text, this.isComplete, this.createdAt, this.updatedAt});
@override
- final String id;
+ final String? id;
@override
- final String text;
+ final String? text;
@override
- final bool isComplete;
+ final bool? isComplete;
@override
- final DateTime createdAt;
+ final DateTime? createdAt;
@override
- final DateTime updatedAt;
+ final DateTime? updatedAt;
Todo copyWith(
- {String id,
- String text,
- bool isComplete,
- DateTime createdAt,
- DateTime updatedAt}) {
+ {String? id,
+ String? text,
+ bool? isComplete,
+ DateTime? createdAt,
+ DateTime? updatedAt}) {
return Todo(
id: id ?? this.id,
text: text ?? this.text,
@@ -39,6 +39,7 @@ class Todo extends _Todo {
updatedAt: updatedAt ?? this.updatedAt);
}
+ @override
bool operator ==(other) {
return other is _Todo &&
other.id == id &&
@@ -55,7 +56,7 @@ class Todo extends _Todo {
@override
String toString() {
- return "Todo(id=$id, text=$text, isComplete=$isComplete, createdAt=$createdAt, updatedAt=$updatedAt)";
+ return 'Todo(id=$id, text=$text, isComplete=$isComplete, createdAt=$createdAt, updatedAt=$updatedAt)';
}
Map toJson() {
@@ -87,30 +88,27 @@ class TodoSerializer extends Codec {
const TodoSerializer();
@override
- get encoder => const TodoEncoder();
+ TodoEncoder get encoder => const TodoEncoder();
@override
- get decoder => const TodoDecoder();
+ TodoDecoder get decoder => const TodoDecoder();
static Todo fromMap(Map map) {
return Todo(
- id: map['id'] as String,
- text: map['text'] as String,
- isComplete: map['is_complete'] as bool,
+ id: map['id'] as String?,
+ text: map['text'] as String?,
+ isComplete: map['is_complete'] as bool?,
createdAt: map['created_at'] != null
? (map['created_at'] is DateTime
- ? (map['created_at'] as 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)
+ ? (map['updated_at'] as DateTime?)
: DateTime.parse(map['updated_at'].toString()))
: null);
}
static Map toMap(_Todo model) {
- if (model == null) {
- return null;
- }
return {
'id': model.id,
'text': model.text,
diff --git a/lib/src/pretty_logging.dart b/lib/src/pretty_logging.dart
deleted file mode 100644
index 1413f0f..0000000
--- a/lib/src/pretty_logging.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-import 'package:angel_http_exception/angel_http_exception.dart';
-import 'package:logging/logging.dart';
-import 'package:io/ansi.dart';
-
-/// Prints the contents of a [LogRecord] with pretty colors.
-void prettyLog(LogRecord record) {
- var code = chooseLogColor(record.level);
-
- if (record.error == null) print(code.wrap(record.toString()));
-
- if (record.error != null) {
- var err = record.error;
- if (err is AngelHttpException && err.statusCode != 500) return;
- print(code.wrap(record.toString() + '\n'));
- print(code.wrap(err.toString()));
-
- if (record.stackTrace != null) {
- print(code.wrap(record.stackTrace.toString()));
- }
- }
-}
-
-/// Chooses a color based on the logger [level].
-AnsiCode chooseLogColor(Level level) {
- if (level == Level.SHOUT)
- return backgroundRed;
- else if (level == Level.SEVERE)
- return red;
- else if (level == Level.WARNING)
- return yellow;
- else if (level == Level.INFO)
- return cyan;
- else if (level == Level.CONFIG ||
- level == Level.FINE ||
- level == Level.FINER ||
- level == Level.FINEST) return lightGray;
- return resetAll;
-}
diff --git a/lib/src/routes/graphql/todo.dart b/lib/src/routes/graphql/todo.dart
index 54c99fd..1f8ad00 100644
--- a/lib/src/routes/graphql/todo.dart
+++ b/lib/src/routes/graphql/todo.dart
@@ -4,12 +4,12 @@ import 'package:angel_graphql/angel_graphql.dart';
import 'package:graphql_schema/graphql_schema.dart';
/// Find or create an in-memory Todo store.
-MapService _getTodoService(Angel app) {
+MapService? _getTodoService(Angel app) {
const key = 'todoService';
// If there is already an existing singleton, return it.
- if (app.container.hasNamed(key)) {
- return app.container.findByName(key);
+ if (app.container!.hasNamed(key)) {
+ return app.container!.findByName(key);
}
// Create an in-memory service. We will use this
@@ -18,14 +18,14 @@ MapService _getTodoService(Angel app) {
// Register this service as a named singleton in the app container,
// so that we do not inadvertently create another instance.
- app.container.registerNamedSingleton(key, mapService);
+ app.container!.registerNamedSingleton(key, mapService);
return mapService;
}
/// Returns fields to be inserted into the query type.
Iterable todoQueryFields(Angel app) {
- var todoService = _getTodoService(app);
+ var todoService = _getTodoService(app)!;
// Here, we use special resolvers to read data from our store.
return [
@@ -47,7 +47,7 @@ Iterable todoQueryFields(Angel app) {
/// Returns fields to be inserted into the query type.
Iterable todoMutationFields(Angel app) {
- var todoService = _getTodoService(app);
+ var todoService = _getTodoService(app)!;
var todoInputType = todoGraphQLType.toInputObject('TodoInput');
// This time, we use resolvers to modify the data in the store.
diff --git a/pubspec.yaml b/pubspec.yaml
index c15e20c..fa772c2 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,85 +1,77 @@
name: angel
description: An app that's going to be amazing pretty soon.
-publish_to: none # Ensure we don't accidentally publish our private code! ;)
+publish_to: none
environment:
- sdk: '>=2.0.0-dev <3.0.0'
-homepage: https://github.com/angel-dart/angel
+ sdk: '>=2.12.0 <3.0.0'
+homepage: https://github.com/dukefirehawk/boilerplates
dependencies:
- angel_auth: ^2.0.0 # Supports stateless authentication via JWT
- angel_configuration: ^2.0.0 # Loads application configuration, along with support for .env files.
- angel_framework: ^2.0.0 # The core server library.
- angel_graphql: ^1.0.0 # Infrastructure for serving GraphQL.
- angel_jael: ^2.0.0 # Server-side templating engine
- angel_production: ^1.0.0 # Production application runner.
- angel_static: ^2.0.0 # Static file server
- angel_validate: ^2.0.0 # Allows for validation of input data
-dev_dependencies:
- angel_hot: ^2.0.0 # Hot-reloading support. :)
- angel_serialize_generator: # Generates serialization code, and more.
- angel_test: ^2.0.0 # Utilities for testing Angel servers.
- build_runner: ^1.0.0 # Runs code builders.
- graphql_generator: ^1.0.0 # Generates GraphQL schemas statically.
- io: ^0.3.2 # For pretty printing.
- pedantic: ^1.0.0 # Enforces Dart style conventions.
- test: ^1.0.0 # For unit testing.
-dependency_overrides:
angel_auth:
git:
url: https://github.com/dukefirehawk/angel.git
- ref: sdk-2.12.x
+ ref: sdk-2.12.x_nnbd
path: packages/auth
angel_configuration:
git:
url: https://github.com/dukefirehawk/angel.git
- ref: sdk-2.12.x
+ ref: sdk-2.12.x_nnbd
path: packages/configuration
angel_framework:
git:
url: https://github.com/dukefirehawk/angel.git
- ref: sdk-2.12.x
+ ref: sdk-2.12.x_nnbd
path: packages/framework
+ angel_graphql:
+ git:
+ url: https://github.com/dukefirehawk/graphql_dart.git
+ ref: sdk-2.12.x_nnbd
+ path: angel_graphql
angel_jael:
git:
url: https://github.com/dukefirehawk/angel.git
- ref: sdk-2.12.x
+ ref: sdk-2.12.x_nnbd
path: packages/jael/angel_jael
angel_production:
git:
url: https://github.com/dukefirehawk/angel.git
- ref: sdk-2.12.x
+ ref: sdk-2.12.x_nnbd
path: packages/production
angel_static:
git:
url: https://github.com/dukefirehawk/angel.git
- ref: sdk-2.12.x
+ ref: sdk-2.12.x_nnbd
path: packages/static
angel_validate:
git:
url: https://github.com/dukefirehawk/angel.git
- ref: sdk-2.12.x
+ ref: sdk-2.12.x_nnbd
path: packages/validate
+dev_dependencies:
angel_hot:
git:
url: https://github.com/dukefirehawk/angel.git
- ref: sdk-2.12.x
+ ref: sdk-2.12.x_nnbd
path: packages/hot
- angel_test:
- git:
- url: https://github.com/dukefirehawk/angel.git
- ref: sdk-2.12.x
- path: packages/test
- angel_graphql:
- git:
- url: https://github.com/dukefirehawk/angel.git
- ref: sdk-2.12.x
- path: packages/graphql/angel_graphql
angel_serialize_generator:
git:
url: https://github.com/dukefirehawk/angel.git
- ref: sdk-2.12.x
+ ref: sdk-2.12.x_nnbd
path: packages/serialize/angel_serialize_generator
- graphql_generator:
+ angel_test:
git:
url: https://github.com/dukefirehawk/angel.git
- ref: sdk-2.12.x
- path: packages/graphql/graphql_generator
+ ref: sdk-2.12.x_nnbd
+ path: packages/test
+ pretty_logging:
+ git:
+ url: https://github.com/dukefirehawk/angel.git
+ ref: sdk-2.12.x_nnbd
+ path: packages/pretty_logging
+ graphql_generator:
+ git:
+ url: https://github.com/dukefirehawk/graphql_dart.git
+ ref: sdk-2.12.x_nnbd
+ path: graphql_generator
+ build_runner: ^2.0.4
+ io: ^1.0.0
+ pedantic: ^1.11.0
+ test: ^1.17.7
diff --git a/test/all_test.dart b/test/all_test.dart
index f059daf..17b1ce7 100644
--- a/test/all_test.dart
+++ b/test/all_test.dart
@@ -19,8 +19,8 @@ import 'package:test/test.dart';
// here:
// https://github.com/dart-lang/test
-main() async {
- TestClient client;
+void main() async {
+ late TestClient client;
setUp(() async {
var app = Angel();
@@ -35,7 +35,7 @@ main() async {
test('index returns 200', () async {
// Request a resource at the given path.
- var response = await client.get('/');
+ var response = await client.get(Uri.parse('/'));
// Expect a 200 response.
expect(response, hasStatus(200));