From d5dba913afd22e5dd13ef03e08294fffef74a6f7 Mon Sep 17 00:00:00 2001 From: thomashii Date: Sat, 26 Jun 2021 21:13:43 +0800 Subject: [PATCH] Removed redundant code --- packages/auth/lib/src/auth_token.dart | 12 +- .../auth_twitter/lib/angel_auth_twitter.dart | 9 +- .../test/reflector_test.reflectable.dart | 6 +- .../lib/src/core/hooked_service.dart | 4 +- .../lib/src/http/http_response_context.dart | 2 + .../lib/src/http2/http2_request_context.dart | 1 + .../lib/src/http2/http2_response_context.dart | 1 + .../framework/test/http2/adapter_test.dart | 2 +- .../framework/test/http2/http2_client.dart | 4 +- .../framework/test/parameter_meta_test.dart | 26 +-- packages/framework/test/server_test.dart | 20 +-- packages/framework/test/streaming_test.dart | 6 +- packages/jael/jael/lib/src/ast/element.dart | 6 +- packages/jael/jael/lib/src/renderer.dart | 4 +- .../jael/jael_web/example/stateful.g.dart | 2 +- .../jael/jael_web/lib/src/builder/util.dart | 2 +- packages/oauth2/lib/src/response.dart | 2 +- .../lib/src/postgres/runner.dart | 2 +- packages/orm/angel_orm/example/main.g.dart | 1 + packages/orm/angel_orm/lib/src/builder.dart | 20 +-- packages/orm/angel_orm/lib/src/union.dart | 2 +- .../angel_orm_generator/example/main.g.dart | 3 +- .../orm/angel_orm_mysql/example/main.g.dart | 31 ++-- .../lib/src/belongs_to_test.dart | 20 +-- .../lib/src/custom_expr_test.dart | 2 +- .../lib/src/edge_case_test.dart | 4 +- .../lib/src/enum_and_nested_test.dart | 2 +- .../angel_orm_test/lib/src/has_many_test.dart | 2 +- .../angel_orm_test/lib/src/has_map_test.dart | 2 +- .../angel_orm_test/lib/src/has_one_test.dart | 4 +- .../lib/src/many_to_many_test.dart | 2 +- .../angel_orm_test/lib/src/models/book.dart | 2 +- .../angel_orm_test/lib/src/models/book.g.dart | 52 +++--- .../angel_orm_test/lib/src/models/car.g.dart | 25 +-- .../lib/src/models/custom_expr.g.dart | 50 +++--- .../lib/src/models/email_indexed.g.dart | 85 +++++----- .../lib/src/models/has_car.g.dart | 25 +-- .../lib/src/models/has_map.g.dart | 21 +-- .../angel_orm_test/lib/src/models/leg.g.dart | 50 +++--- .../lib/src/models/order.g.dart | 50 +++--- .../angel_orm_test/lib/src/models/tree.g.dart | 58 +++---- .../lib/src/models/unorthodox.dart | 1 + .../lib/src/models/unorthodox.g.dart | 158 +++++++++--------- .../angel_orm_test/lib/src/models/user.g.dart | 89 +++++----- .../lib/src/standalone_test.dart | 26 +-- packages/orm/angel_orm_test/lib/src/util.dart | 4 +- packages/relations/lib/src/belongs_to.dart | 2 +- .../relations/lib/src/belongs_to_many.dart | 2 +- packages/relations/test/belongs_to_test.dart | 1 - packages/relations/test/common.dart | 4 +- packages/relations/test/has_one_test.dart | 3 +- packages/rethink/test/bootstrap.dart | 6 +- packages/rethink/test/common.dart | 2 +- packages/rethink/test/generic_test.dart | 2 +- packages/route/lib/browser.dart | 2 +- .../route/lib/src/middleware_pipeline.dart | 2 +- packages/route/test/server_test.dart | 2 +- .../lib/src/service_rate_limiter.dart | 4 +- packages/seeder/test/all_test.dart | 2 +- .../test/models/book.dart | 1 - .../test/models/book.g.dart | 8 +- .../test/models/game_pad_button.g.dart | 18 +- .../test/models/goat.g.dart | 7 +- .../test/models/has_map.g.dart | 7 +- .../test/models/subclass.g.dart | 14 +- .../test/models/with_enum.g.dart | 7 +- packages/shelf/example/main.dart | 2 +- packages/shelf/lib/src/embed_shelf.dart | 4 +- packages/symbol_table/example/main.dart | 10 +- packages/validate/test/basic_test.dart | 2 +- packages/wings/benchmark/util.dart | 2 + packages/wings/lib/src/wings_request.dart | 2 +- packages/wings/lib/src/wings_response.dart | 4 +- 73 files changed, 534 insertions(+), 490 deletions(-) diff --git a/packages/auth/lib/src/auth_token.dart b/packages/auth/lib/src/auth_token.dart index 3dddfac9..9190c19c 100644 --- a/packages/auth/lib/src/auth_token.dart +++ b/packages/auth/lib/src/auth_token.dart @@ -107,12 +107,12 @@ class AuthToken { Map toJson() { return _splayify({ - "iss": "angel_auth", - "aud": ipAddress, - "exp": lifeSpan, - "iat": issuedAt.toIso8601String(), - "sub": userId, - "pld": _splayify(payload) + 'iss': 'angel_auth', + 'aud': ipAddress, + 'exp': lifeSpan, + 'iat': issuedAt.toIso8601String(), + 'sub': userId, + 'pld': _splayify(payload) }); } } diff --git a/packages/auth_twitter/lib/angel_auth_twitter.dart b/packages/auth_twitter/lib/angel_auth_twitter.dart index e60d5fdb..0b722fc0 100644 --- a/packages/auth_twitter/lib/angel_auth_twitter.dart +++ b/packages/auth_twitter/lib/angel_auth_twitter.dart @@ -81,7 +81,7 @@ class TwitterStrategy extends AuthStrategy { 'accept': 'application/json' }, body: { - "oauth_callback": options.redirectUri.toString() + 'oauth_callback': options.redirectUri.toString() }).then(handleUrlEncodedResponse); } @@ -91,17 +91,18 @@ class TwitterStrategy extends AuthStrategy { try { if (options != null) { var result = await authenticateCallback(req, res, options); - if (result is User) + if (result is User) { return result; - else + } else { return null; + } } else { var result = await getRequestToken(); var token = result['oauth_token']; var url = baseUrl.replace( path: p.join(baseUrl.path, 'oauth/authorize'), queryParameters: {'oauth_token': token}); - res.redirect(url); + await res.redirect(url); return null; } } on TwitterAuthorizationException catch (e) { diff --git a/packages/container/angel_container_generator/test/reflector_test.reflectable.dart b/packages/container/angel_container_generator/test/reflector_test.reflectable.dart index da76f3ba..5b9ec4c8 100644 --- a/packages/container/angel_container_generator/test/reflector_test.reflectable.dart +++ b/packages/container/angel_container_generator/test/reflector_test.reflectable.dart @@ -391,8 +391,10 @@ final _data = { }, {}, { - r"": (b) => ([length]) => - b ? (length == null ? List() : List(length)) : null, + r"": (b) => ([length]) => b + ? (length == null ? [] : [] + ..length) + : null, r"filled": (b) => (length, fill, {growable: false}) => b ? List.filled(length, fill, growable: growable) : null, r"from": (b) => (elements, {growable: true}) => diff --git a/packages/framework/lib/src/core/hooked_service.dart b/packages/framework/lib/src/core/hooked_service.dart index 6e676de0..cb21e815 100644 --- a/packages/framework/lib/src/core/hooked_service.dart +++ b/packages/framework/lib/src/core/hooked_service.dart @@ -164,7 +164,7 @@ class HookedService> case HookedServiceEvent.removed: return beforeRemoved; default: - throw ArgumentError('Invalid service method: ${name}'); + throw ArgumentError('Invalid service method: $name'); } }).forEach((HookedServiceEventDispatcher dispatcher) => dispatcher.listen(listener)); @@ -188,7 +188,7 @@ class HookedService> case HookedServiceEvent.removed: return afterRemoved; default: - throw ArgumentError('Invalid service method: ${name}'); + throw ArgumentError('Invalid service method: $name'); } }).forEach((HookedServiceEventDispatcher dispatcher) => dispatcher.listen(listener)); diff --git a/packages/framework/lib/src/http/http_response_context.dart b/packages/framework/lib/src/http/http_response_context.dart index 077fe956..a830c369 100644 --- a/packages/framework/lib/src/http/http_response_context.dart +++ b/packages/framework/lib/src/http/http_response_context.dart @@ -12,6 +12,8 @@ class HttpResponseContext extends ResponseContext { /// The underlying [HttpResponse] under this instance. @override final HttpResponse rawResponse; + + @override Angel? app; LockableBytesBuilder? _buffer; diff --git a/packages/framework/lib/src/http2/http2_request_context.dart b/packages/framework/lib/src/http2/http2_request_context.dart index 71452dd8..64fc8227 100644 --- a/packages/framework/lib/src/http2/http2_request_context.dart +++ b/packages/framework/lib/src/http2/http2_request_context.dart @@ -13,6 +13,7 @@ final RegExp _straySlashes = RegExp(r'(^/+)|(/+$)'); class Http2RequestContext extends RequestContext { final StreamController> _body = StreamController(); + @override final Container container; List _cookies = []; HttpHeaders? _headers; diff --git a/packages/framework/lib/src/http2/http2_response_context.dart b/packages/framework/lib/src/http2/http2_response_context.dart index 4ec9af6c..48daed21 100644 --- a/packages/framework/lib/src/http2/http2_response_context.dart +++ b/packages/framework/lib/src/http2/http2_response_context.dart @@ -6,6 +6,7 @@ import 'package:http2/transport.dart'; import 'http2_request_context.dart'; class Http2ResponseContext extends ResponseContext { + @override final Angel? app; final ServerTransportStream stream; diff --git a/packages/framework/test/http2/adapter_test.dart b/packages/framework/test/http2/adapter_test.dart index a212fbb4..595cf5e1 100644 --- a/packages/framework/test/http2/adapter_test.dart +++ b/packages/framework/test/http2/adapter_test.dart @@ -205,7 +205,7 @@ void main() { Header.ascii(':scheme', serverRoot.scheme), ]; - var stream = await connection.makeRequest(headers, endStream: true); + var stream = connection.makeRequest(headers, endStream: true); var bb = await stream.incomingMessages .where((s) => s is DataStreamMessage) diff --git a/packages/framework/test/http2/http2_client.dart b/packages/framework/test/http2/http2_client.dart index 2903fe3c..c200d7c5 100644 --- a/packages/framework/test/http2/http2_client.dart +++ b/packages/framework/test/http2/http2_client.dart @@ -41,12 +41,12 @@ class Http2Client extends BaseClient { headers.add(Header.ascii(k, v)); }); - var stream = await connection.makeRequest(headers, endStream: body.isEmpty); + var stream = connection.makeRequest(headers, endStream: body.isEmpty); if (body.isNotEmpty) { stream.sendData(body, endStream: true); } else { - (stream.outgoingMessages.close()); + await (stream.outgoingMessages.close()); } return stream; diff --git a/packages/framework/test/parameter_meta_test.dart b/packages/framework/test/parameter_meta_test.dart index db87d606..d87f6b80 100644 --- a/packages/framework/test/parameter_meta_test.dart +++ b/packages/framework/test/parameter_meta_test.dart @@ -70,9 +70,9 @@ parameterMetaTests() { test('injects header or throws', () async { // Invalid request var rq = MockHttpRequest('GET', Uri.parse('/header')); - (rq.close()); + await (rq.close()); var rs = rq.response; - (http.handleRequest(rq)); + await (http.handleRequest(rq)); await printResponse(rs); expect(rs.statusCode, 400); @@ -80,7 +80,7 @@ parameterMetaTests() { // Valid request rq = MockHttpRequest('GET', Uri.parse('/header')) ..headers.add('x-foo', 'bar'); - (rq.close()); + await (rq.close()); rs = rq.response; await (http.handleRequest(rq)); @@ -93,9 +93,9 @@ parameterMetaTests() { test('injects session or throws', () async { // Invalid request var rq = MockHttpRequest('GET', Uri.parse('/session')); - (rq.close()); + await (rq.close()); var rs = rq.response; - (http + await (http .handleRequest(rq) .timeout(const Duration(seconds: 5)) .catchError((_) => null)); @@ -105,9 +105,9 @@ parameterMetaTests() { rq = MockHttpRequest('GET', Uri.parse('/session')); rq.session['foo'] = 'bar'; - (rq.close()); + await (rq.close()); rs = rq.response; - (http.handleRequest(rq)); + await (http.handleRequest(rq)); await printResponse(rs); expect(rs.statusCode, 200); @@ -119,18 +119,18 @@ parameterMetaTests() { test('pattern matching', () async { var rq = MockHttpRequest('GET', Uri.parse('/match?mode=pos')); - (rq.close()); + await (rq.close()); var rs = rq.response; - (http.handleRequest(rq)); + await (http.handleRequest(rq)); var body = await readResponse(rs); print('Body: $body'); expect(rs.statusCode, 200); expect(body, json.encode('YES pos')); rq = MockHttpRequest('GET', Uri.parse('/match?mode=neg')); - (rq.close()); + await (rq.close()); rs = rq.response; - (http.handleRequest(rq)); + await (http.handleRequest(rq)); body = await readResponse(rs); print('Body: $body'); expect(rs.statusCode, 200); @@ -138,9 +138,9 @@ parameterMetaTests() { // Fallback rq = MockHttpRequest('GET', Uri.parse('/match?mode=ambi')); - (rq.close()); + await (rq.close()); rs = rq.response; - (http.handleRequest(rq)); + await (http.handleRequest(rq)); body = await readResponse(rs); print('Body: $body'); expect(rs.statusCode, 200); diff --git a/packages/framework/test/server_test.dart b/packages/framework/test/server_test.dart index 190a999f..e597277a 100644 --- a/packages/framework/test/server_test.dart +++ b/packages/framework/test/server_test.dart @@ -42,7 +42,7 @@ void main() { var app = Angel(reflector: MirrorsReflector()); var http = AngelHttp(app); var rq = MockHttpRequest('GET', $foo); - (rq.close()); + await (rq.close()); var rs = rq.response; var req = await http.createRequestContext(rq, rs); var res = await http.createResponseContext(rq, rs); @@ -94,7 +94,7 @@ void main() { var http = AngelHttp(app); app.get('/', ioc((String a) => a)); var rq = MockHttpRequest('GET', Uri.parse('/')); - (rq.close()); + await (rq.close()); await http.handleRequest(rq); var body = await rq.response.transform(utf8.decoder).join(); expect(body, json.encode('b')); @@ -105,7 +105,7 @@ void main() { var http = AngelHttp(app); app.get($foo.path, (req, ResponseContext res) => res.serialize(null)); var rq = MockHttpRequest('GET', $foo); - (rq.close()); + await (rq.close()); await http.handleRequest(rq); var body = await rq.response.transform(utf8.decoder).join(); expect(body, 'x'); @@ -121,7 +121,7 @@ void main() { setUp(() async { var rq = MockHttpRequest('GET', $foo); - (rq.close()); + await (rq.close()); req = await http.createRequestContext(rq, rq.response); res = await http.createResponseContext(rq, rq.response); }); @@ -178,8 +178,8 @@ void main() { test('can send json', () async { var rq = MockHttpRequest('GET', Uri(path: 'wtf')) ..headers.set('accept', 'application/json'); - (rq.close()); - (http.handleRequest(rq)); + await (rq.close()); + await (http.handleRequest(rq)); await rq.response.toList(); expect(rq.response.statusCode, 403); expect(rq.response.headers.contentType!.mimeType, 'application/json'); @@ -188,8 +188,8 @@ void main() { test('can throw in finalizer', () async { var rq = MockHttpRequest('GET', Uri(path: 'wtf')) ..headers.set('accept', 'application/json'); - (rq.close()); - (http.handleRequest(rq)); + await (rq.close()); + await (http.handleRequest(rq)); await rq.response.toList(); expect(rq.response.statusCode, 403); expect(rq.response.headers.contentType!.mimeType, 'application/json'); @@ -198,8 +198,8 @@ void main() { test('can send html', () async { var rq = MockHttpRequest('GET', Uri(path: 'wtf2')); rq.headers.set('accept', 'text/html'); - (rq.close()); - (http.handleRequest(rq)); + await (rq.close()); + await (http.handleRequest(rq)); await rq.response.toList(); expect(rq.response.statusCode, 403); expect(rq.response.headers.contentType?.mimeType, 'text/html'); diff --git a/packages/framework/test/streaming_test.dart b/packages/framework/test/streaming_test.dart index a66b1938..f8664f5f 100644 --- a/packages/framework/test/streaming_test.dart +++ b/packages/framework/test/streaming_test.dart @@ -77,7 +77,7 @@ void main() { _expectHelloBye(String path) async { var rq = MockHttpRequest('GET', Uri.parse(path)); - (rq.close()); + await (rq.close()); await http.handleRequest(rq); var body = await rq.response.transform(utf8.decoder).join(); expect(body, 'Hello, world!bye'); @@ -90,7 +90,7 @@ void main() { test('cannot write after close', () async { try { var rq = MockHttpRequest('GET', Uri.parse('/overwrite')); - (rq.close()); + await (rq.close()); await http.handleRequest(rq); var body = await rq.response.transform(utf8.decoder).join(); @@ -105,7 +105,7 @@ void main() { test('res => addError', () async { try { var rq = MockHttpRequest('GET', Uri.parse('/error')); - (rq.close()); + await (rq.close()); await http.handleRequest(rq); var body = await rq.response.transform(utf8.decoder).join(); throw 'addError should throw error; response: $body'; diff --git a/packages/jael/jael/lib/src/ast/element.dart b/packages/jael/jael/lib/src/ast/element.dart index c7ad7205..6d8fafe0 100644 --- a/packages/jael/jael/lib/src/ast/element.dart +++ b/packages/jael/jael/lib/src/ast/element.dart @@ -73,8 +73,12 @@ class RegularElement extends Element { final Token? gt2; final Token lt2, slash, lt, gt; - final Identifier tagName, tagName2; + @override + final Identifier tagName; + final Identifier tagName2; + @override final Iterable attributes; + @override final Iterable children; RegularElement(this.lt, this.tagName, this.attributes, this.gt, this.children, diff --git a/packages/jael/jael/lib/src/renderer.dart b/packages/jael/jael/lib/src/renderer.dart index 4c79eb80..32d36e57 100644 --- a/packages/jael/jael/lib/src/renderer.dart +++ b/packages/jael/jael/lib/src/renderer.dart @@ -205,7 +205,7 @@ class Renderer { element.gt2); } - int i = 0; + var i = 0; for (var item in attribute.value!.compute(scope)) { var childScope = scope.createChild(values: {alias: item, indexAs: i++}); renderElement(strippedElement, buffer, childScope, html5); @@ -255,7 +255,7 @@ class Renderer { value: attribute.value?.compute(scope), constant: true); } - for (int i = 0; i < element.children.length; i++) { + for (var i = 0; i < element.children.length; i++) { var child = element.children.elementAt(i); renderElementChild( element, child, buffer, scope, html5, i, element.children.length); diff --git a/packages/jael/jael_web/example/stateful.g.dart b/packages/jael/jael_web/example/stateful.g.dart index 27186d57..545b82c6 100644 --- a/packages/jael/jael_web/example/stateful.g.dart +++ b/packages/jael/jael_web/example/stateful.g.dart @@ -7,7 +7,7 @@ part of 'stateful.dart'; // ************************************************************************** abstract class _StatefulAppJaelTemplate implements Component<_AppState> { - Timer? get _timer; + //Timer? get _timer; void beforeDestroy(); @override DomNode render() { diff --git a/packages/jael/jael_web/lib/src/builder/util.dart b/packages/jael/jael_web/lib/src/builder/util.dart index e0b2b681..56b85f96 100644 --- a/packages/jael/jael_web/lib/src/builder/util.dart +++ b/packages/jael/jael_web/lib/src/builder/util.dart @@ -12,7 +12,7 @@ import 'package:path/src/context.dart'; /// Converts a [DartType] to a [TypeReference]. TypeReference convertTypeReference(DartType? t) { return new TypeReference((b) { - b..symbol = t!.name; + b..symbol = t?.getDisplayString(withNullability: false); if (t is InterfaceType) { b.types.addAll(t.typeArguments.map(convertTypeReference)); diff --git a/packages/oauth2/lib/src/response.dart b/packages/oauth2/lib/src/response.dart index 444c0254..da342e27 100644 --- a/packages/oauth2/lib/src/response.dart +++ b/packages/oauth2/lib/src/response.dart @@ -66,7 +66,7 @@ class DeviceCodeResponse { } if (interval != null) out['interval'] = interval; - if (expiresIn != null) out['expires_in'] = expiresIn; + out['expires_in'] = expiresIn; return out; } diff --git a/packages/orm/angel_migration_runner/lib/src/postgres/runner.dart b/packages/orm/angel_migration_runner/lib/src/postgres/runner.dart index 4a650b08..3ecbbb1c 100755 --- a/packages/orm/angel_migration_runner/lib/src/postgres/runner.dart +++ b/packages/orm/angel_migration_runner/lib/src/postgres/runner.dart @@ -13,7 +13,7 @@ class PostgresMigrationRunner implements MigrationRunner { bool _connected = false; PostgresMigrationRunner(this.connection, - {Iterable migrations = const [], bool connected: false}) { + {Iterable migrations = const [], bool connected = false}) { if (migrations.isNotEmpty == true) migrations.forEach(addMigration); _connected = connected == true; } diff --git a/packages/orm/angel_orm/example/main.g.dart b/packages/orm/angel_orm/example/main.g.dart index 0c5634fe..80c3d42c 100644 --- a/packages/orm/angel_orm/example/main.g.dart +++ b/packages/orm/angel_orm/example/main.g.dart @@ -50,6 +50,7 @@ class Employee extends _Employee { updatedAt: updatedAt ?? this.updatedAt); } + @override bool operator ==(other) { return other is _Employee && other.id == id && diff --git a/packages/orm/angel_orm/lib/src/builder.dart b/packages/orm/angel_orm/lib/src/builder.dart index 82b93efd..1fc48ec6 100644 --- a/packages/orm/angel_orm/lib/src/builder.dart +++ b/packages/orm/angel_orm/lib/src/builder.dart @@ -54,13 +54,13 @@ class NumericSqlExpressionBuilder return '$_op $v'; } - operator <(T value) => _change('<', value); + bool operator <(T value) => _change('<', value); - operator >(T value) => _change('>', value); + bool operator >(T value) => _change('>', value); - operator <=(T value) => _change('<=', value); + bool operator <=(T value) => _change('<=', value); - operator >=(T value) => _change('>=', value); + bool operator >=(T value) => _change('>=', value); void get isNull { _raw = 'IS NULL'; @@ -210,7 +210,7 @@ class StringSqlExpressionBuilder extends SqlExpressionBuilder { String? compile() { if (_raw != null) return _raw; if (_value == null) return null; - return "$_op @$substitution"; + return '$_op @$substitution'; } void isEmpty() => equals(''); @@ -254,7 +254,7 @@ class StringSqlExpressionBuilder extends SqlExpressionBuilder { void isNotBetween(String lower, String upper) { query.substitutionValues[lowerName] = lower; query.substitutionValues[upperName] = upper; - _raw = "NOT BETWEEN @$lowerName AND @$upperName"; + _raw = 'NOT BETWEEN @$lowerName AND @$upperName'; _hasValue = true; } @@ -381,13 +381,13 @@ class DateTimeSqlExpressionBuilder extends SqlExpressionBuilder { return true; } - operator <(DateTime value) => _change('<', value, true); + bool operator <(DateTime value) => _change('<', value, true); - operator <=(DateTime value) => _change('<=', value, true); + bool operator <=(DateTime value) => _change('<=', value, true); - operator >(DateTime value) => _change('>', value, true); + bool operator >(DateTime value) => _change('>', value, true); - operator >=(DateTime value) => _change('>=', value, true); + bool operator >=(DateTime value) => _change('>=', value, true); void equals(DateTime value, {bool includeTime = true}) { _change('=', value, includeTime != false); diff --git a/packages/orm/angel_orm/lib/src/union.dart b/packages/orm/angel_orm/lib/src/union.dart index 9557e193..5ab2f862 100644 --- a/packages/orm/angel_orm/lib/src/union.dart +++ b/packages/orm/angel_orm/lib/src/union.dart @@ -13,7 +13,7 @@ class Union extends QueryBase { final String tableName; Union(this.left, this.right, {this.all = false, String? tableName}) - : this.tableName = tableName ?? left.tableName { + : tableName = tableName ?? left.tableName { substitutionValues ..addAll(left.substitutionValues) ..addAll(right.substitutionValues); diff --git a/packages/orm/angel_orm_generator/example/main.g.dart b/packages/orm/angel_orm_generator/example/main.g.dart index faa48672..447f4863 100644 --- a/packages/orm/angel_orm_generator/example/main.g.dart +++ b/packages/orm/angel_orm_generator/example/main.g.dart @@ -128,7 +128,7 @@ class EmployeeQueryWhere extends QueryWhere { class EmployeeQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {'salary': 'decimal'}; } @@ -235,6 +235,7 @@ class Employee extends _Employee { salary: salary ?? this.salary); } + @override bool operator ==(other) { return other is _Employee && other.id == id && diff --git a/packages/orm/angel_orm_mysql/example/main.g.dart b/packages/orm/angel_orm_mysql/example/main.g.dart index 7e898fc8..3261e6d2 100644 --- a/packages/orm/angel_orm_mysql/example/main.g.dart +++ b/packages/orm/angel_orm_mysql/example/main.g.dart @@ -8,10 +8,10 @@ part of 'main.dart'; class TodoMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('todos', (table) { - table.serial('id')..primaryKey(); - table.boolean('is_complete')..defaultsTo(false); + table.serial('id').primaryKey(); + table.boolean('is_complete').defaultsTo(false); table.varChar('text'); table.timeStamp('created_at'); table.timeStamp('updated_at'); @@ -19,7 +19,7 @@ class TodoMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('todos'); } } @@ -30,7 +30,7 @@ class TodoMigration extends Migration { class TodoQuery extends Query { TodoQuery({Set? trampoline}) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = TodoQueryWhere(this); } @@ -41,17 +41,17 @@ class TodoQuery extends Query { TodoQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'todos'; } @override - get fields { + List get fields { return const ['id', 'is_complete', 'text', 'created_at', 'updated_at']; } @@ -101,14 +101,14 @@ class TodoQueryWhere extends QueryWhere { final DateTimeSqlExpressionBuilder updatedAt; @override - get expressionBuilders { + List get expressionBuilders { return [id, isComplete, text, createdAt, updatedAt]; } } class TodoQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -179,7 +179,7 @@ class Todo extends _Todo { String? text, DateTime? createdAt, DateTime? updatedAt}) { - return new Todo( + return Todo( id: id ?? this.id, isComplete: isComplete ?? this.isComplete, text: text ?? this.text, @@ -187,6 +187,7 @@ class Todo extends _Todo { updatedAt: updatedAt ?? this.updatedAt); } + @override bool operator ==(other) { return other is _Todo && other.id == id && @@ -213,11 +214,10 @@ class Todo extends _Todo { abstract class TodoSerializer { static Todo fromMap(Map map) { if (map['is_complete'] == null) { - throw new FormatException( - "Missing required field 'is_complete' on Todo."); + throw FormatException("Missing required field 'is_complete' on Todo."); } - return new Todo( + return Todo( id: map['id'] as String?, isComplete: map['is_complete'] as bool? ?? false, text: map['text'] as String?, @@ -235,8 +235,7 @@ abstract class TodoSerializer { static Map toMap(_Todo model) { if (model.isComplete == null) { - throw new FormatException( - "Missing required field 'is_complete' on Todo."); + throw FormatException("Missing required field 'is_complete' on Todo."); } return { diff --git a/packages/orm/angel_orm_test/lib/src/belongs_to_test.dart b/packages/orm/angel_orm_test/lib/src/belongs_to_test.dart index 4872cca8..f55f442c 100644 --- a/packages/orm/angel_orm_test/lib/src/belongs_to_test.dart +++ b/packages/orm/angel_orm_test/lib/src/belongs_to_test.dart @@ -5,7 +5,7 @@ import 'models/book.dart'; import 'util.dart'; -belongsToTests(FutureOr Function() createExecutor, +void belongsToTests(FutureOr Function() createExecutor, {FutureOr Function(QueryExecutor)? close}) { late QueryExecutor executor; Author? jkRowling; @@ -38,7 +38,7 @@ belongsToTests(FutureOr Function() createExecutor, group('selects', () { test('select all', () async { var query = BookQuery(); - List books = await query.get(executor); + var books = await query.get(executor); expect(books, hasLength(1)); var book = books.first; @@ -55,7 +55,7 @@ belongsToTests(FutureOr Function() createExecutor, test('select one', () async { var query = BookQuery(); query.where!.id.equals(int.parse(deathlyHallows!.id!)); - print(query.compile(Set())); + print(query.compile({})); var bookOpt = await query.getOne(executor); expect(bookOpt.isPresent, true); @@ -75,9 +75,9 @@ belongsToTests(FutureOr Function() createExecutor, var query = BookQuery() ..where!.name.equals('Goblet of Fire') ..orWhere((w) => w.authorId.equals(int.parse(jkRowling!.id!))); - print(query.compile(Set())); + print(query.compile({})); - List books = await query.get(executor); + var books = await query.get(executor); expect(books, hasLength(1)); var book = books.first; @@ -99,9 +99,9 @@ belongsToTests(FutureOr Function() createExecutor, query1 ..union(query2) ..unionAll(query3); - print(query1.compile(Set())); + print(query1.compile({})); - List books = await query1.get(executor); + var books = await query1.get(executor); expect(books, hasLength(1)); var book = books.first; @@ -117,7 +117,7 @@ belongsToTests(FutureOr Function() createExecutor, test('order by', () async { var query = AuthorQuery()..orderBy(AuthorFields.name, descending: true); - List authors = await query.get(executor); + var authors = await query.get(executor); expect(authors, [jkRowling, jameson]); }); }); @@ -131,8 +131,8 @@ belongsToTests(FutureOr Function() createExecutor, test('delete stream', () async { printSeparator('Delete stream test'); var query = BookQuery()..where!.name.equals(deathlyHallows!.name!); - print(query.compile(Set(), preamble: 'DELETE', withFields: false)); - List books = await query.delete(executor); + print(query.compile({}, preamble: 'DELETE', withFields: false)); + var books = await query.delete(executor); expect(books, hasLength(1)); var book = books.first; diff --git a/packages/orm/angel_orm_test/lib/src/custom_expr_test.dart b/packages/orm/angel_orm_test/lib/src/custom_expr_test.dart index 53440f80..96538535 100644 --- a/packages/orm/angel_orm_test/lib/src/custom_expr_test.dart +++ b/packages/orm/angel_orm_test/lib/src/custom_expr_test.dart @@ -3,7 +3,7 @@ import 'package:angel3_orm/angel3_orm.dart'; import 'package:test/test.dart'; import 'models/custom_expr.dart'; -customExprTests(FutureOr Function() createExecutor, +void customExprTests(FutureOr Function() createExecutor, {FutureOr Function(QueryExecutor)? close}) { late QueryExecutor executor; Numbers? numbersModel; diff --git a/packages/orm/angel_orm_test/lib/src/edge_case_test.dart b/packages/orm/angel_orm_test/lib/src/edge_case_test.dart index 41bf5982..c52a254f 100644 --- a/packages/orm/angel_orm_test/lib/src/edge_case_test.dart +++ b/packages/orm/angel_orm_test/lib/src/edge_case_test.dart @@ -3,7 +3,7 @@ import 'package:angel3_orm/angel3_orm.dart'; import 'package:test/test.dart'; import 'models/unorthodox.dart'; -edgeCaseTests(FutureOr Function() createExecutor, +void edgeCaseTests(FutureOr Function() createExecutor, {FutureOr Function(QueryExecutor)? close}) { late QueryExecutor executor; close ??= (_) => null; @@ -81,7 +81,7 @@ edgeCaseTests(FutureOr Function() createExecutor, test('has many', () async { var numbas = []; - for (int i = 0; i < 15; i++) { + for (var i = 0; i < 15; i++) { var query = NumbaQuery() ..values.parent = weirdJoin!.id ..values.i = i; diff --git a/packages/orm/angel_orm_test/lib/src/enum_and_nested_test.dart b/packages/orm/angel_orm_test/lib/src/enum_and_nested_test.dart index 096f3694..1fdf2530 100644 --- a/packages/orm/angel_orm_test/lib/src/enum_and_nested_test.dart +++ b/packages/orm/angel_orm_test/lib/src/enum_and_nested_test.dart @@ -3,7 +3,7 @@ import 'package:angel3_orm/angel3_orm.dart'; import 'package:test/test.dart'; import 'models/has_car.dart'; -enumAndNestedTests(FutureOr Function() createExecutor, +void enumAndNestedTests(FutureOr Function() createExecutor, {FutureOr Function(QueryExecutor)? close}) { late QueryExecutor executor; close ??= (_) => null; diff --git a/packages/orm/angel_orm_test/lib/src/has_many_test.dart b/packages/orm/angel_orm_test/lib/src/has_many_test.dart index 8e6b5169..4d31a063 100644 --- a/packages/orm/angel_orm_test/lib/src/has_many_test.dart +++ b/packages/orm/angel_orm_test/lib/src/has_many_test.dart @@ -3,7 +3,7 @@ import 'package:angel3_orm/angel3_orm.dart'; import 'package:test/test.dart'; import 'models/tree.dart'; -hasManyTests(FutureOr Function() createExecutor, +void hasManyTests(FutureOr Function() createExecutor, {FutureOr Function(QueryExecutor)? close}) { late QueryExecutor executor; Tree? appleTree; diff --git a/packages/orm/angel_orm_test/lib/src/has_map_test.dart b/packages/orm/angel_orm_test/lib/src/has_map_test.dart index 14c85a90..e7c78ed1 100644 --- a/packages/orm/angel_orm_test/lib/src/has_map_test.dart +++ b/packages/orm/angel_orm_test/lib/src/has_map_test.dart @@ -3,7 +3,7 @@ import 'package:angel3_orm/angel3_orm.dart'; import 'package:test/test.dart'; import 'models/has_map.dart'; -hasMapTests(FutureOr Function() createExecutor, +void hasMapTests(FutureOr Function() createExecutor, {FutureOr Function(QueryExecutor)? close}) { late QueryExecutor executor; close ??= (_) => null; diff --git a/packages/orm/angel_orm_test/lib/src/has_one_test.dart b/packages/orm/angel_orm_test/lib/src/has_one_test.dart index 78c45ca2..cd133c74 100644 --- a/packages/orm/angel_orm_test/lib/src/has_one_test.dart +++ b/packages/orm/angel_orm_test/lib/src/has_one_test.dart @@ -3,7 +3,7 @@ import 'package:angel3_orm/angel3_orm.dart'; import 'package:test/test.dart'; import 'models/leg.dart'; -hasOneTests(FutureOr Function() createExecutor, +void hasOneTests(FutureOr Function() createExecutor, {FutureOr Function(QueryExecutor)? close}) { late QueryExecutor executor; Leg? originalLeg; @@ -18,7 +18,7 @@ hasOneTests(FutureOr Function() createExecutor, tearDown(() => close!(executor)); test('sets to null if no child', () async { - print(LegQuery().compile(Set())); + print(LegQuery().compile({})); var query = LegQuery()..where!.id.equals(int.parse(originalLeg!.id!)); var legOpt = await (query.getOne(executor)); expect(legOpt.isPresent, true); diff --git a/packages/orm/angel_orm_test/lib/src/many_to_many_test.dart b/packages/orm/angel_orm_test/lib/src/many_to_many_test.dart index c7a778fb..cdf622b9 100644 --- a/packages/orm/angel_orm_test/lib/src/many_to_many_test.dart +++ b/packages/orm/angel_orm_test/lib/src/many_to_many_test.dart @@ -5,7 +5,7 @@ import 'package:test/test.dart'; import 'models/user.dart'; import 'util.dart'; -manyToManyTests(FutureOr Function() createExecutor, +void manyToManyTests(FutureOr Function() createExecutor, {FutureOr Function(QueryExecutor)? close}) { late QueryExecutor executor; Role? canPub, canSub; diff --git a/packages/orm/angel_orm_test/lib/src/models/book.dart b/packages/orm/angel_orm_test/lib/src/models/book.dart index fd95f1ad..6684164f 100644 --- a/packages/orm/angel_orm_test/lib/src/models/book.dart +++ b/packages/orm/angel_orm_test/lib/src/models/book.dart @@ -14,7 +14,7 @@ class _Book extends Model { @BelongsTo(joinType: JoinType.inner) _Author? author; - @BelongsTo(localKey: "partner_author_id", joinType: JoinType.inner) + @BelongsTo(localKey: 'partner_author_id', joinType: JoinType.inner) _Author? partnerAuthor; String? name; diff --git a/packages/orm/angel_orm_test/lib/src/models/book.g.dart b/packages/orm/angel_orm_test/lib/src/models/book.g.dart index 83cf7735..8ea9cbe6 100644 --- a/packages/orm/angel_orm_test/lib/src/models/book.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/book.g.dart @@ -8,9 +8,9 @@ part of angel_orm3.generator.models.book; class BookMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('books', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); table.varChar('name'); @@ -24,24 +24,24 @@ class BookMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('books'); } } class AuthorMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('authors', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); - table.varChar('name', length: 255)..defaultsTo('Tobe Osakwe'); + table.varChar('name', length: 255).defaultsTo('Tobe Osakwe'); }); } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('authors'); } } @@ -52,7 +52,7 @@ class AuthorMigration extends Migration { class BookQuery extends Query { BookQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = BookQueryWhere(this); join(_author = AuthorQuery(trampoline: trampoline, parent: this), @@ -75,17 +75,17 @@ class BookQuery extends Query { AuthorQuery? _partnerAuthor; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'books'; } @override - get fields { + List get fields { return const [ 'id', 'created_at', @@ -167,14 +167,14 @@ class BookQueryWhere extends QueryWhere { final StringSqlExpressionBuilder name; @override - get expressionBuilders { + List get expressionBuilders { return [id, createdAt, updatedAt, authorId, partnerAuthorId, name]; } } class BookQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -224,7 +224,7 @@ class BookQueryValues extends MapQueryValues { class AuthorQuery extends Query { AuthorQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = AuthorQueryWhere(this); } @@ -235,17 +235,17 @@ class AuthorQuery extends Query { AuthorQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'authors'; } @override - get fields { + List get fields { return const ['id', 'created_at', 'updated_at', 'name']; } @@ -293,14 +293,14 @@ class AuthorQueryWhere extends QueryWhere { final StringSqlExpressionBuilder name; @override - get expressionBuilders { + List get expressionBuilders { return [id, createdAt, updatedAt, name]; } } class AuthorQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -382,6 +382,7 @@ class Book extends _Book { name: name ?? this.name); } + @override bool operator ==(other) { return other is _Book && other.id == id && @@ -399,7 +400,7 @@ class Book extends _Book { @override String toString() { - return "Book(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, author=$author, partnerAuthor=$partnerAuthor, name=$name)"; + return 'Book(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, author=$author, partnerAuthor=$partnerAuthor, name=$name)'; } Map toJson() { @@ -435,6 +436,7 @@ class Author extends _Author { name: name ?? this.name); } + @override bool operator ==(other) { return other is _Author && other.id == id && @@ -450,7 +452,7 @@ class Author extends _Author { @override String toString() { - return "Author(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, name=$name)"; + return 'Author(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, name=$name)'; } Map? toJson() { @@ -482,9 +484,9 @@ class BookSerializer extends Codec { const BookSerializer(); @override - get encoder => const BookEncoder(); + BookEncoder get encoder => const BookEncoder(); @override - get decoder => const BookDecoder(); + BookDecoder get decoder => const BookDecoder(); static Book fromMap(Map map) { return Book( id: map['id'] as String?, @@ -562,9 +564,9 @@ class AuthorSerializer extends Codec { const AuthorSerializer(); @override - get encoder => const AuthorEncoder(); + AuthorEncoder get encoder => const AuthorEncoder(); @override - get decoder => const AuthorDecoder(); + AuthorDecoder get decoder => const AuthorDecoder(); static Author fromMap(Map map) { return Author( id: map['id'] as String?, diff --git a/packages/orm/angel_orm_test/lib/src/models/car.g.dart b/packages/orm/angel_orm_test/lib/src/models/car.g.dart index ddff3fc2..3bd8bf41 100644 --- a/packages/orm/angel_orm_test/lib/src/models/car.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/car.g.dart @@ -8,9 +8,9 @@ part of angel_orm3.generator.models.car; class CarMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('cars', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); table.varChar('make'); @@ -21,7 +21,7 @@ class CarMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('cars'); } } @@ -32,7 +32,7 @@ class CarMigration extends Migration { class CarQuery extends Query { CarQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = CarQueryWhere(this); } @@ -43,17 +43,17 @@ class CarQuery extends Query { CarQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'cars'; } @override - get fields { + List get fields { return const [ 'id', 'created_at', @@ -121,7 +121,7 @@ class CarQueryWhere extends QueryWhere { final DateTimeSqlExpressionBuilder recalledAt; @override - get expressionBuilders { + List get expressionBuilders { return [ id, createdAt, @@ -136,7 +136,7 @@ class CarQueryWhere extends QueryWhere { class CarQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -242,6 +242,7 @@ class Car extends _Car { recalledAt: recalledAt ?? this.recalledAt); } + @override bool operator ==(other) { return other is _Car && other.id == id && @@ -268,7 +269,7 @@ class Car extends _Car { @override String toString() { - return "Car(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, make=$make, description=$description, familyFriendly=$familyFriendly, recalledAt=$recalledAt)"; + return 'Car(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, make=$make, description=$description, familyFriendly=$familyFriendly, recalledAt=$recalledAt)'; } Map toJson() { @@ -300,9 +301,9 @@ class CarSerializer extends Codec { const CarSerializer(); @override - get encoder => const CarEncoder(); + CarEncoder get encoder => const CarEncoder(); @override - get decoder => const CarDecoder(); + CarDecoder get decoder => const CarDecoder(); static Car fromMap(Map map) { return Car( id: map['id'] as String?, diff --git a/packages/orm/angel_orm_test/lib/src/models/custom_expr.g.dart b/packages/orm/angel_orm_test/lib/src/models/custom_expr.g.dart index 94886c9a..96352be7 100644 --- a/packages/orm/angel_orm_test/lib/src/models/custom_expr.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/custom_expr.g.dart @@ -8,25 +8,25 @@ part of 'custom_expr.dart'; class NumbersMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('numbers', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); }); } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('numbers'); } } class AlphabetMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('alphabets', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); table.varChar('value'); @@ -37,7 +37,7 @@ class AlphabetMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('alphabets'); } } @@ -49,7 +49,7 @@ class AlphabetMigration extends Migration { class NumbersQuery extends Query { NumbersQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); expressions['two'] = 'SELECT 2'; _where = NumbersQueryWhere(this); @@ -61,17 +61,17 @@ class NumbersQuery extends Query { NumbersQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'numbers'; } @override - get fields { + List get fields { return const ['id', 'created_at', 'updated_at', 'two']; } @@ -116,14 +116,14 @@ class NumbersQueryWhere extends QueryWhere { final DateTimeSqlExpressionBuilder updatedAt; @override - get expressionBuilders { + List get expressionBuilders { return [id, createdAt, updatedAt]; } } class NumbersQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -151,7 +151,7 @@ class NumbersQueryValues extends MapQueryValues { class AlphabetQuery extends Query { AlphabetQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = AlphabetQueryWhere(this); leftJoin(_numbers = NumbersQuery(trampoline: trampoline, parent: this), @@ -168,17 +168,17 @@ class AlphabetQuery extends Query { NumbersQuery? _numbers; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'alphabets'; } @override - get fields { + List get fields { return const ['id', 'created_at', 'updated_at', 'value', 'numbers_id']; } @@ -239,14 +239,14 @@ class AlphabetQueryWhere extends QueryWhere { final NumericSqlExpressionBuilder numbersId; @override - get expressionBuilders { + List get expressionBuilders { return [id, createdAt, updatedAt, value, numbersId]; } } class AlphabetQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -317,6 +317,7 @@ class Numbers extends _Numbers { two: two ?? this.two); } + @override bool operator ==(other) { return other is _Numbers && other.id == id && @@ -332,7 +333,7 @@ class Numbers extends _Numbers { @override String toString() { - return "Numbers(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, two=$two)"; + return 'Numbers(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, two=$two)'; } Map? toJson() { @@ -376,6 +377,7 @@ class Alphabet extends _Alphabet { numbers: numbers ?? this.numbers); } + @override bool operator ==(other) { return other is _Alphabet && other.id == id && @@ -392,7 +394,7 @@ class Alphabet extends _Alphabet { @override String toString() { - return "Alphabet(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, value=$value, numbers=$numbers)"; + return 'Alphabet(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, value=$value, numbers=$numbers)'; } Map toJson() { @@ -424,9 +426,9 @@ class NumbersSerializer extends Codec { const NumbersSerializer(); @override - get encoder => const NumbersEncoder(); + NumbersEncoder get encoder => const NumbersEncoder(); @override - get decoder => const NumbersDecoder(); + NumbersDecoder get decoder => const NumbersDecoder(); static Numbers fromMap(Map map) { return Numbers( id: map['id'] as String?, @@ -488,9 +490,9 @@ class AlphabetSerializer extends Codec { const AlphabetSerializer(); @override - get encoder => const AlphabetEncoder(); + AlphabetEncoder get encoder => const AlphabetEncoder(); @override - get decoder => const AlphabetDecoder(); + AlphabetDecoder get decoder => const AlphabetDecoder(); static Alphabet fromMap(Map map) { return Alphabet( id: map['id'] as String?, diff --git a/packages/orm/angel_orm_test/lib/src/models/email_indexed.g.dart b/packages/orm/angel_orm_test/lib/src/models/email_indexed.g.dart index 49f2dce9..72fc90e2 100644 --- a/packages/orm/angel_orm_test/lib/src/models/email_indexed.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/email_indexed.g.dart @@ -8,21 +8,21 @@ part of 'email_indexed.dart'; class RoleMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('roles', (table) { - table.declare('role', ColumnType('varchar'))..primaryKey(); + table.declare('role', ColumnType('varchar')).primaryKey(); }); } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('roles', cascade: true); } } class RoleUserMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('role_users', (table) { table .declare('role_role', ColumnType('varchar')) @@ -34,23 +34,23 @@ class RoleUserMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('role_users'); } } class UserMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('users', (table) { - table.varChar('email')..primaryKey(); + table.varChar('email').primaryKey(); table.varChar('name'); table.varChar('password'); }); } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('users', cascade: true); } } @@ -61,7 +61,7 @@ class UserMigration extends Migration { class RoleQuery extends Query { RoleQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = RoleQueryWhere(this); leftJoin( @@ -78,17 +78,17 @@ class RoleQuery extends Query { late RoleQueryWhere _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'roles'; } @override - get fields { + List get fields { return const ['role']; } @@ -128,7 +128,7 @@ class RoleQuery extends Query { } @override - get(QueryExecutor executor) { + Future> get(QueryExecutor executor) { return super.get(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.role == model.role); @@ -146,7 +146,7 @@ class RoleQuery extends Query { } @override - update(QueryExecutor executor) { + Future> update(QueryExecutor executor) { return super.update(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.role == model.role); @@ -164,7 +164,7 @@ class RoleQuery extends Query { } @override - delete(QueryExecutor executor) { + Future> delete(QueryExecutor executor) { return super.delete(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.role == model.role); @@ -189,14 +189,14 @@ class RoleQueryWhere extends QueryWhere { final StringSqlExpressionBuilder role; @override - get expressionBuilders { + List get expressionBuilders { return [role]; } } class RoleQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -213,7 +213,7 @@ class RoleQueryValues extends MapQueryValues { class RoleUserQuery extends Query { RoleUserQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = RoleUserQueryWhere(this); leftJoin(_role = RoleQuery(trampoline: trampoline, parent: this), @@ -235,17 +235,17 @@ class RoleUserQuery extends Query { UserQuery? _user; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'role_users'; } @override - get fields { + List get fields { return const ['role_role', 'user_email']; } @@ -303,14 +303,14 @@ class RoleUserQueryWhere extends QueryWhere { final StringSqlExpressionBuilder userEmail; @override - get expressionBuilders { + List get expressionBuilders { return [roleRole, userEmail]; } } class RoleUserQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -336,7 +336,7 @@ class RoleUserQueryValues extends MapQueryValues { class UserQuery extends Query { UserQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = UserQueryWhere(this); leftJoin( @@ -353,17 +353,17 @@ class UserQuery extends Query { UserQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'users'; } @override - get fields { + List get fields { return const ['email', 'name', 'password']; } @@ -410,7 +410,7 @@ class UserQuery extends Query { } @override - get(QueryExecutor executor) { + Future> get(QueryExecutor executor) { return super.get(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.email == model.email); @@ -428,7 +428,7 @@ class UserQuery extends Query { } @override - update(QueryExecutor executor) { + Future> update(QueryExecutor executor) { return super.update(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.email == model.email); @@ -446,7 +446,7 @@ class UserQuery extends Query { } @override - delete(QueryExecutor executor) { + Future> delete(QueryExecutor executor) { return super.delete(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.email == model.email); @@ -477,14 +477,14 @@ class UserQueryWhere extends QueryWhere { final StringSqlExpressionBuilder password; @override - get expressionBuilders { + List get expressionBuilders { return [email, name, password]; } } class UserQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -528,6 +528,7 @@ class Role implements _Role { return Role(role: role ?? this.role, users: users); } + @override bool operator ==(other) { return other is _Role && other.role == role && @@ -542,7 +543,7 @@ class Role implements _Role { @override String toString() { - return "Role(role=$role, users=$users)"; + return 'Role(role=$role, users=$users)'; } Map toJson() { @@ -564,6 +565,7 @@ class RoleUser implements _RoleUser { return RoleUser(role: role ?? this.role, user: user ?? this.user); } + @override bool operator ==(other) { return other is _RoleUser && other.role == role && other.user == user; } @@ -575,7 +577,7 @@ class RoleUser implements _RoleUser { @override String toString() { - return "RoleUser(role=$role, user=$user)"; + return 'RoleUser(role=$role, user=$user)'; } Map toJson() { @@ -608,6 +610,7 @@ class User implements _User { roles: roles ?? []); } + @override bool operator ==(other) { return other is _User && other.email == email && @@ -624,7 +627,7 @@ class User implements _User { @override String toString() { - return "User(email=$email, name=$name, password=$password, roles=$roles)"; + return 'User(email=$email, name=$name, password=$password, roles=$roles)'; } Map toJson() { @@ -656,9 +659,9 @@ class RoleSerializer extends Codec { const RoleSerializer(); @override - get encoder => const RoleEncoder(); + RoleEncoder get encoder => const RoleEncoder(); @override - get decoder => const RoleDecoder(); + RoleDecoder get decoder => const RoleDecoder(); static Role fromMap(Map map) { return Role( role: map['role'] as String?, @@ -704,9 +707,9 @@ class RoleUserSerializer extends Codec { const RoleUserSerializer(); @override - get encoder => const RoleUserEncoder(); + RoleUserEncoder get encoder => const RoleUserEncoder(); @override - get decoder => const RoleUserDecoder(); + RoleUserDecoder get decoder => const RoleUserDecoder(); static RoleUser fromMap(Map map) { return RoleUser( role: map['role'] != null @@ -753,9 +756,9 @@ class UserSerializer extends Codec { const UserSerializer(); @override - get encoder => const UserEncoder(); + UserEncoder get encoder => const UserEncoder(); @override - get decoder => const UserDecoder(); + UserDecoder get decoder => const UserDecoder(); static User fromMap(Map map) { return User( email: map['email'] as String?, diff --git a/packages/orm/angel_orm_test/lib/src/models/has_car.g.dart b/packages/orm/angel_orm_test/lib/src/models/has_car.g.dart index c28f3fee..0fb00c3f 100644 --- a/packages/orm/angel_orm_test/lib/src/models/has_car.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/has_car.g.dart @@ -8,9 +8,9 @@ part of 'has_car.dart'; class HasCarMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('has_cars', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); table.integer('type'); @@ -18,7 +18,7 @@ class HasCarMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('has_cars'); } } @@ -30,7 +30,7 @@ class HasCarMigration extends Migration { class HasCarQuery extends Query { HasCarQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = HasCarQueryWhere(this); } @@ -41,17 +41,17 @@ class HasCarQuery extends Query { HasCarQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'has_cars'; } @override - get fields { + List get fields { return const ['id', 'created_at', 'updated_at', 'type']; } @@ -100,14 +100,14 @@ class HasCarQueryWhere extends QueryWhere { final EnumSqlExpressionBuilder type; @override - get expressionBuilders { + List get expressionBuilders { return [id, createdAt, updatedAt, type]; } } class HasCarQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -170,6 +170,7 @@ class HasCar extends _HasCar { type: type ?? this.type); } + @override bool operator ==(other) { return other is _HasCar && other.id == id && @@ -185,7 +186,7 @@ class HasCar extends _HasCar { @override String toString() { - return "HasCar(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, type=$type)"; + return 'HasCar(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, type=$type)'; } Map toJson() { @@ -217,9 +218,9 @@ class HasCarSerializer extends Codec { const HasCarSerializer(); @override - get encoder => const HasCarEncoder(); + HasCarEncoder get encoder => const HasCarEncoder(); @override - get decoder => const HasCarDecoder(); + HasCarDecoder get decoder => const HasCarDecoder(); static HasCar fromMap(Map map) { if (map['type'] == null) { throw FormatException("Missing required field 'type' on HasCar."); diff --git a/packages/orm/angel_orm_test/lib/src/models/has_map.g.dart b/packages/orm/angel_orm_test/lib/src/models/has_map.g.dart index 066c85dd..a7792852 100644 --- a/packages/orm/angel_orm_test/lib/src/models/has_map.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/has_map.g.dart @@ -8,7 +8,7 @@ part of 'has_map.dart'; class HasMapMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('has_maps', (table) { table.declare('value', ColumnType('jsonb')); table.declare('list', ColumnType('jsonb')); @@ -16,7 +16,7 @@ class HasMapMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('has_maps'); } } @@ -28,7 +28,7 @@ class HasMapMigration extends Migration { class HasMapQuery extends Query { HasMapQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = HasMapQueryWhere(this); } @@ -39,17 +39,17 @@ class HasMapQuery extends Query { HasMapQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'has_maps'; } @override - get fields { + List get fields { return const ['value', 'list']; } @@ -90,14 +90,14 @@ class HasMapQueryWhere extends QueryWhere { final ListSqlExpressionBuilder list; @override - get expressionBuilders { + List get expressionBuilders { return [value, list]; } } class HasMapQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {'list': 'jsonb'}; } @@ -136,6 +136,7 @@ class HasMap implements _HasMap { return HasMap(value: value, list: list); } + @override bool operator ==(other) { return other is _HasMap && MapEquality( @@ -183,9 +184,9 @@ class HasMapSerializer extends Codec { const HasMapSerializer(); @override - get encoder => const HasMapEncoder(); + HasMapEncoder get encoder => const HasMapEncoder(); @override - get decoder => const HasMapDecoder(); + HasMapDecoder get decoder => const HasMapDecoder(); static HasMap fromMap(Map map) { return HasMap( value: map['value'] is Map diff --git a/packages/orm/angel_orm_test/lib/src/models/leg.g.dart b/packages/orm/angel_orm_test/lib/src/models/leg.g.dart index 118947fd..30249dde 100644 --- a/packages/orm/angel_orm_test/lib/src/models/leg.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/leg.g.dart @@ -8,9 +8,9 @@ part of angel3_orm_generator.test.models.leg; class LegMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('legs', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); table.varChar('name'); @@ -18,16 +18,16 @@ class LegMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('legs', cascade: true); } } class FootMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('feet', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); table.integer('leg_id'); @@ -36,7 +36,7 @@ class FootMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('feet'); } } @@ -47,7 +47,7 @@ class FootMigration extends Migration { class LegQuery extends Query { LegQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = LegQueryWhere(this); leftJoin( @@ -70,17 +70,17 @@ class LegQuery extends Query { FootQuery? _foot; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'legs'; } @override - get fields { + List get fields { return const ['id', 'created_at', 'updated_at', 'name']; } @@ -138,14 +138,14 @@ class LegQueryWhere extends QueryWhere { final StringSqlExpressionBuilder name; @override - get expressionBuilders { + List get expressionBuilders { return [id, createdAt, updatedAt, name]; } } class LegQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -178,7 +178,7 @@ class LegQueryValues extends MapQueryValues { class FootQuery extends Query { FootQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = FootQueryWhere(this); } @@ -189,17 +189,17 @@ class FootQuery extends Query { FootQueryWhere? _where; @override - get casts { + Map get casts { return {'n_toes': 'text'}; } @override - get tableName { + String get tableName { return 'feet'; } @override - get fields { + List get fields { return const ['id', 'created_at', 'updated_at', 'leg_id', 'n_toes']; } @@ -251,14 +251,14 @@ class FootQueryWhere extends QueryWhere { final NumericSqlExpressionBuilder nToes; @override - get expressionBuilders { + List get expressionBuilders { return [id, createdAt, updatedAt, legId, nToes]; } } class FootQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {'n_toes': 'decimal'}; } @@ -335,6 +335,7 @@ class Leg extends _Leg { name: name ?? this.name); } + @override bool operator ==(other) { return other is _Leg && other.id == id && @@ -351,7 +352,7 @@ class Leg extends _Leg { @override String toString() { - return "Leg(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, foot=$foot, name=$name)"; + return 'Leg(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, foot=$foot, name=$name)'; } Map toJson() { @@ -395,6 +396,7 @@ class Foot extends _Foot { nToes: nToes ?? this.nToes); } + @override bool operator ==(other) { return other is _Foot && other.id == id && @@ -411,7 +413,7 @@ class Foot extends _Foot { @override String toString() { - return "Foot(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, legId=$legId, nToes=$nToes)"; + return 'Foot(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, legId=$legId, nToes=$nToes)'; } Map? toJson() { @@ -443,9 +445,9 @@ class LegSerializer extends Codec { const LegSerializer(); @override - get encoder => const LegEncoder(); + LegEncoder get encoder => const LegEncoder(); @override - get decoder => const LegDecoder(); + LegDecoder get decoder => const LegDecoder(); static Leg fromMap(Map map) { return Leg( id: map['id'] as String?, @@ -516,9 +518,9 @@ class FootSerializer extends Codec { const FootSerializer(); @override - get encoder => const FootEncoder(); + FootEncoder get encoder => const FootEncoder(); @override - get decoder => const FootDecoder(); + FootDecoder get decoder => const FootDecoder(); static Foot fromMap(Map map) { return Foot( id: map['id'] as String?, diff --git a/packages/orm/angel_orm_test/lib/src/models/order.g.dart b/packages/orm/angel_orm_test/lib/src/models/order.g.dart index 02c51cd3..41591f3f 100644 --- a/packages/orm/angel_orm_test/lib/src/models/order.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/order.g.dart @@ -8,9 +8,9 @@ part of angel3_orm_generator.test.models.order; class OrderMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('orders', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); table.integer('employee_id'); @@ -23,23 +23,23 @@ class OrderMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('orders'); } } class CustomerMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('customers', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); }); } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('customers'); } } @@ -50,7 +50,7 @@ class CustomerMigration extends Migration { class OrderQuery extends Query { OrderQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = OrderQueryWhere(this); leftJoin(_customer = CustomerQuery(trampoline: trampoline, parent: this), @@ -67,17 +67,17 @@ class OrderQuery extends Query { CustomerQuery? _customer; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'orders'; } @override - get fields { + List get fields { return const [ 'id', 'created_at', @@ -154,7 +154,7 @@ class OrderQueryWhere extends QueryWhere { final NumericSqlExpressionBuilder shipperId; @override - get expressionBuilders { + List get expressionBuilders { return [ id, createdAt, @@ -169,7 +169,7 @@ class OrderQueryWhere extends QueryWhere { class OrderQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -223,7 +223,7 @@ class OrderQueryValues extends MapQueryValues { class CustomerQuery extends Query { CustomerQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = CustomerQueryWhere(this); } @@ -234,17 +234,17 @@ class CustomerQuery extends Query { CustomerQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'customers'; } @override - get fields { + List get fields { return const ['id', 'created_at', 'updated_at']; } @@ -288,14 +288,14 @@ class CustomerQueryWhere extends QueryWhere { final DateTimeSqlExpressionBuilder updatedAt; @override - get expressionBuilders { + List get expressionBuilders { return [id, createdAt, updatedAt]; } } class CustomerQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -377,6 +377,7 @@ class Order extends _Order { shipperId: shipperId ?? this.shipperId); } + @override bool operator ==(other) { return other is _Order && other.id == id && @@ -396,7 +397,7 @@ class Order extends _Order { @override String toString() { - return "Order(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, customer=$customer, employeeId=$employeeId, orderDate=$orderDate, shipperId=$shipperId)"; + return 'Order(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, customer=$customer, employeeId=$employeeId, orderDate=$orderDate, shipperId=$shipperId)'; } Map toJson() { @@ -427,6 +428,7 @@ class Customer extends _Customer { updatedAt: updatedAt ?? this.updatedAt); } + @override bool operator ==(other) { return other is _Customer && other.id == id && @@ -441,7 +443,7 @@ class Customer extends _Customer { @override String toString() { - return "Customer(id=$id, createdAt=$createdAt, updatedAt=$updatedAt)"; + return 'Customer(id=$id, createdAt=$createdAt, updatedAt=$updatedAt)'; } Map? toJson() { @@ -473,9 +475,9 @@ class OrderSerializer extends Codec { const OrderSerializer(); @override - get encoder => const OrderEncoder(); + OrderEncoder get encoder => const OrderEncoder(); @override - get decoder => const OrderDecoder(); + OrderDecoder get decoder => const OrderDecoder(); static Order fromMap(Map map) { return Order( id: map['id'] as String?, @@ -560,9 +562,9 @@ class CustomerSerializer extends Codec { const CustomerSerializer(); @override - get encoder => const CustomerEncoder(); + CustomerEncoder get encoder => const CustomerEncoder(); @override - get decoder => const CustomerDecoder(); + CustomerDecoder get decoder => const CustomerDecoder(); static Customer fromMap(Map map) { return Customer( id: map['id'] as String?, diff --git a/packages/orm/angel_orm_test/lib/src/models/tree.g.dart b/packages/orm/angel_orm_test/lib/src/models/tree.g.dart index 28831d8d..b7c61f83 100644 --- a/packages/orm/angel_orm_test/lib/src/models/tree.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/tree.g.dart @@ -8,9 +8,9 @@ part of angel3_orm_generator.test.models.tree; class TreeMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('trees', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); table.declare('rings', ColumnType('smallint')); @@ -18,16 +18,16 @@ class TreeMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('trees', cascade: true); } } class FruitMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('fruits', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); table.integer('tree_id'); @@ -36,7 +36,7 @@ class FruitMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('fruits'); } } @@ -47,7 +47,7 @@ class FruitMigration extends Migration { class TreeQuery extends Query { TreeQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = TreeQueryWhere(this); leftJoin(_fruits = FruitQuery(trampoline: trampoline, parent: this), 'id', @@ -70,17 +70,17 @@ class TreeQuery extends Query { FruitQuery? _fruits; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'trees'; } @override - get fields { + List get fields { return const ['id', 'created_at', 'updated_at', 'rings']; } @@ -122,7 +122,7 @@ class TreeQuery extends Query { } @override - get(QueryExecutor executor) { + Future> get(QueryExecutor executor) { return super.get(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.id == model.id); @@ -141,7 +141,7 @@ class TreeQuery extends Query { } @override - update(QueryExecutor executor) { + Future> update(QueryExecutor executor) { return super.update(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.id == model.id); @@ -160,7 +160,7 @@ class TreeQuery extends Query { } @override - delete(QueryExecutor executor) { + Future> delete(QueryExecutor executor) { return super.delete(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.id == model.id); @@ -195,14 +195,14 @@ class TreeQueryWhere extends QueryWhere { final NumericSqlExpressionBuilder rings; @override - get expressionBuilders { + List get expressionBuilders { return [id, createdAt, updatedAt, rings]; } } class TreeQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -235,7 +235,7 @@ class TreeQueryValues extends MapQueryValues { class FruitQuery extends Query { FruitQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = FruitQueryWhere(this); } @@ -246,17 +246,17 @@ class FruitQuery extends Query { FruitQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'fruits'; } @override - get fields { + List get fields { return const ['id', 'created_at', 'updated_at', 'tree_id', 'common_name']; } @@ -308,14 +308,14 @@ class FruitQueryWhere extends QueryWhere { final StringSqlExpressionBuilder commonName; @override - get expressionBuilders { + List get expressionBuilders { return [id, createdAt, updatedAt, treeId, commonName]; } } class FruitQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -364,7 +364,7 @@ class Tree extends _Tree { this.updatedAt, this.rings, List<_Fruit> fruits = const []}) - : this.fruits = List.unmodifiable(fruits); + : fruits = List.unmodifiable(fruits); /// A unique identifier corresponding to this item. @override @@ -398,6 +398,7 @@ class Tree extends _Tree { fruits: fruits); } + @override bool operator ==(other) { return other is _Tree && other.id == id && @@ -415,7 +416,7 @@ class Tree extends _Tree { @override String toString() { - return "Tree(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, rings=$rings, fruits=$fruits)"; + return 'Tree(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, rings=$rings, fruits=$fruits)'; } Map toJson() { @@ -460,6 +461,7 @@ class Fruit extends _Fruit { commonName: commonName ?? this.commonName); } + @override bool operator ==(other) { return other is _Fruit && other.id == id && @@ -476,7 +478,7 @@ class Fruit extends _Fruit { @override String toString() { - return "Fruit(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, treeId=$treeId, commonName=$commonName)"; + return 'Fruit(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, treeId=$treeId, commonName=$commonName)'; } Map toJson() { @@ -508,9 +510,9 @@ class TreeSerializer extends Codec { const TreeSerializer(); @override - get encoder => const TreeEncoder(); + TreeEncoder get encoder => const TreeEncoder(); @override - get decoder => const TreeDecoder(); + TreeDecoder get decoder => const TreeDecoder(); static Tree fromMap(Map map) { return Tree( id: map['id'] as String?, @@ -582,9 +584,9 @@ class FruitSerializer extends Codec { const FruitSerializer(); @override - get encoder => const FruitEncoder(); + FruitEncoder get encoder => const FruitEncoder(); @override - get decoder => const FruitDecoder(); + FruitDecoder get decoder => const FruitDecoder(); static Fruit fromMap(Map map) { return Fruit( id: map['id'] as String?, diff --git a/packages/orm/angel_orm_test/lib/src/models/unorthodox.dart b/packages/orm/angel_orm_test/lib/src/models/unorthodox.dart index 0a38090b..7d6ef21b 100644 --- a/packages/orm/angel_orm_test/lib/src/models/unorthodox.dart +++ b/packages/orm/angel_orm_test/lib/src/models/unorthodox.dart @@ -48,6 +48,7 @@ class _Numba implements Comparable<_Numba> { int? parent; + @override int compareTo(_Numba other) => i!.compareTo(other.i!); } diff --git a/packages/orm/angel_orm_test/lib/src/models/unorthodox.g.dart b/packages/orm/angel_orm_test/lib/src/models/unorthodox.g.dart index 20c8baed..0e9df12b 100644 --- a/packages/orm/angel_orm_test/lib/src/models/unorthodox.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/unorthodox.g.dart @@ -8,23 +8,23 @@ part of 'unorthodox.dart'; class UnorthodoxMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('unorthodoxes', (table) { table.varChar('name'); }); } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('unorthodoxes'); } } class WeirdJoinMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('weird_joins', (table) { - table.integer('id')..primaryKey(); + table.integer('id').primaryKey(); table .declare('join_name', ColumnType('varchar')) .references('unorthodoxes', 'name'); @@ -32,16 +32,16 @@ class WeirdJoinMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('weird_joins', cascade: true); } } class SongMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('songs', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); table.integer('weird_join_id'); @@ -50,43 +50,43 @@ class SongMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('songs'); } } class NumbaMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('numbas', (table) { - table.integer('i')..primaryKey(); + table.integer('i').primaryKey(); table.integer('parent'); }); } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('numbas'); } } class FooMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('foos', (table) { - table.varChar('bar')..primaryKey(); + table.varChar('bar').primaryKey(); }); } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('foos', cascade: true); } } class FooPivotMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('foo_pivots', (table) { table .declare('weird_join_id', ColumnType('int')) @@ -96,7 +96,7 @@ class FooPivotMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('foo_pivots'); } } @@ -108,7 +108,7 @@ class FooPivotMigration extends Migration { class UnorthodoxQuery extends Query { UnorthodoxQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = UnorthodoxQueryWhere(this); } @@ -119,17 +119,17 @@ class UnorthodoxQuery extends Query { UnorthodoxQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'unorthodoxes'; } @override - get fields { + List get fields { return const ['name']; } @@ -164,14 +164,14 @@ class UnorthodoxQueryWhere extends QueryWhere { final StringSqlExpressionBuilder name; @override - get expressionBuilders { + List get expressionBuilders { return [name]; } } class UnorthodoxQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -188,7 +188,7 @@ class UnorthodoxQueryValues extends MapQueryValues { class WeirdJoinQuery extends Query { WeirdJoinQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = WeirdJoinQueryWhere(this); leftJoin( @@ -230,17 +230,17 @@ class WeirdJoinQuery extends Query { NumbaQuery? _numbas; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'weird_joins'; } @override - get fields { + List get fields { return const ['id', 'join_name']; } @@ -310,7 +310,7 @@ class WeirdJoinQuery extends Query { } @override - get(QueryExecutor executor) { + Future> get(QueryExecutor executor) { return super.get(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.id == model.id); @@ -330,7 +330,7 @@ class WeirdJoinQuery extends Query { } @override - update(QueryExecutor executor) { + Future> update(QueryExecutor executor) { return super.update(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.id == model.id); @@ -350,7 +350,7 @@ class WeirdJoinQuery extends Query { } @override - delete(QueryExecutor executor) { + Future> delete(QueryExecutor executor) { return super.delete(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.id == model.id); @@ -380,14 +380,14 @@ class WeirdJoinQueryWhere extends QueryWhere { final StringSqlExpressionBuilder joinName; @override - get expressionBuilders { + List get expressionBuilders { return [id, joinName]; } } class WeirdJoinQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -411,7 +411,7 @@ class WeirdJoinQueryValues extends MapQueryValues { class SongQuery extends Query { SongQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = SongQueryWhere(this); } @@ -422,17 +422,17 @@ class SongQuery extends Query { SongQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'songs'; } @override - get fields { + List get fields { return const ['id', 'created_at', 'updated_at', 'weird_join_id', 'title']; } @@ -484,14 +484,14 @@ class SongQueryWhere extends QueryWhere { final StringSqlExpressionBuilder title; @override - get expressionBuilders { + List get expressionBuilders { return [id, createdAt, updatedAt, weirdJoinId, title]; } } class SongQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -530,7 +530,7 @@ class SongQueryValues extends MapQueryValues { class NumbaQuery extends Query { NumbaQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = NumbaQueryWhere(this); } @@ -541,17 +541,17 @@ class NumbaQuery extends Query { NumbaQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'numbas'; } @override - get fields { + List get fields { return const ['i', 'parent']; } @@ -589,14 +589,14 @@ class NumbaQueryWhere extends QueryWhere { final NumericSqlExpressionBuilder parent; @override - get expressionBuilders { + List get expressionBuilders { return [i, parent]; } } class NumbaQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -618,7 +618,7 @@ class NumbaQueryValues extends MapQueryValues { class FooQuery extends Query { FooQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = FooQueryWhere(this); leftJoin( @@ -635,17 +635,17 @@ class FooQuery extends Query { FooQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'foos'; } @override - get fields { + List get fields { return const ['bar']; } @@ -685,7 +685,7 @@ class FooQuery extends Query { } @override - get(QueryExecutor executor) { + Future> get(QueryExecutor executor) { return super.get(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.bar == model.bar); @@ -704,7 +704,7 @@ class FooQuery extends Query { } @override - update(QueryExecutor executor) { + Future> update(QueryExecutor executor) { return super.update(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.bar == model.bar); @@ -723,7 +723,7 @@ class FooQuery extends Query { } @override - delete(QueryExecutor executor) { + Future> delete(QueryExecutor executor) { return super.delete(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.bar == model.bar); @@ -749,14 +749,14 @@ class FooQueryWhere extends QueryWhere { final StringSqlExpressionBuilder bar; @override - get expressionBuilders { + List get expressionBuilders { return [bar]; } } class FooQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -773,7 +773,7 @@ class FooQueryValues extends MapQueryValues { class FooPivotQuery extends Query { FooPivotQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = FooPivotQueryWhere(this); leftJoin(_weirdJoin = WeirdJoinQuery(trampoline: trampoline, parent: this), @@ -794,17 +794,17 @@ class FooPivotQuery extends Query { FooQuery? _foo; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'foo_pivots'; } @override - get fields { + List get fields { return const ['weird_join_id', 'foo_bar']; } @@ -862,14 +862,14 @@ class FooPivotQueryWhere extends QueryWhere { final StringSqlExpressionBuilder fooBar; @override - get expressionBuilders { + List get expressionBuilders { return [weirdJoinId, fooBar]; } } class FooPivotQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -908,6 +908,7 @@ class Unorthodox implements _Unorthodox { return Unorthodox(name: name ?? this.name); } + @override bool operator ==(other) { return other is _Unorthodox && other.name == name; } @@ -919,7 +920,7 @@ class Unorthodox implements _Unorthodox { @override String toString() { - return "Unorthodox(name=$name)"; + return 'Unorthodox(name=$name)'; } Map? toJson() { @@ -961,6 +962,7 @@ class WeirdJoin implements _WeirdJoin { foos: foos ?? this.foos); } + @override bool operator ==(other) { return other is _WeirdJoin && other.id == id && @@ -978,7 +980,7 @@ class WeirdJoin implements _WeirdJoin { @override String toString() { - return "WeirdJoin(id=$id, unorthodox=$unorthodox, song=$song, numbas=$numbas, foos=$foos)"; + return 'WeirdJoin(id=$id, unorthodox=$unorthodox, song=$song, numbas=$numbas, foos=$foos)'; } Map? toJson() { @@ -1022,6 +1024,7 @@ class Song extends _Song { title: title ?? this.title); } + @override bool operator ==(other) { return other is _Song && other.id == id && @@ -1038,7 +1041,7 @@ class Song extends _Song { @override String toString() { - return "Song(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, weirdJoinId=$weirdJoinId, title=$title)"; + return 'Song(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, weirdJoinId=$weirdJoinId, title=$title)'; } Map? toJson() { @@ -1060,6 +1063,7 @@ class Numba extends _Numba { return Numba(i: i ?? this.i, parent: parent ?? this.parent); } + @override bool operator ==(other) { return other is _Numba && other.i == i && other.parent == parent; } @@ -1071,7 +1075,7 @@ class Numba extends _Numba { @override String toString() { - return "Numba(i=$i, parent=$parent)"; + return 'Numba(i=$i, parent=$parent)'; } Map? toJson() { @@ -1093,6 +1097,7 @@ class Foo implements _Foo { return Foo(bar: bar ?? this.bar, weirdJoins: weirdJoins ?? this.weirdJoins); } + @override bool operator ==(other) { return other is _Foo && other.bar == bar && @@ -1107,7 +1112,7 @@ class Foo implements _Foo { @override String toString() { - return "Foo(bar=$bar, weirdJoins=$weirdJoins)"; + return 'Foo(bar=$bar, weirdJoins=$weirdJoins)'; } Map? toJson() { @@ -1130,6 +1135,7 @@ class FooPivot implements _FooPivot { weirdJoin: weirdJoin ?? this.weirdJoin, foo: foo ?? this.foo); } + @override bool operator ==(other) { return other is _FooPivot && other.weirdJoin == weirdJoin && @@ -1143,7 +1149,7 @@ class FooPivot implements _FooPivot { @override String toString() { - return "FooPivot(weirdJoin=$weirdJoin, foo=$foo)"; + return 'FooPivot(weirdJoin=$weirdJoin, foo=$foo)'; } Map toJson() { @@ -1175,9 +1181,9 @@ class UnorthodoxSerializer extends Codec { const UnorthodoxSerializer(); @override - get encoder => const UnorthodoxEncoder(); + UnorthodoxEncoder get encoder => const UnorthodoxEncoder(); @override - get decoder => const UnorthodoxDecoder(); + UnorthodoxDecoder get decoder => const UnorthodoxDecoder(); static Unorthodox fromMap(Map map) { return Unorthodox(name: map['name'] as String?); } @@ -1216,9 +1222,9 @@ class WeirdJoinSerializer extends Codec { const WeirdJoinSerializer(); @override - get encoder => const WeirdJoinEncoder(); + WeirdJoinEncoder get encoder => const WeirdJoinEncoder(); @override - get decoder => const WeirdJoinDecoder(); + WeirdJoinDecoder get decoder => const WeirdJoinDecoder(); static WeirdJoin fromMap(Map map) { return WeirdJoin( id: map['id'] as int?, @@ -1292,9 +1298,9 @@ class SongSerializer extends Codec { const SongSerializer(); @override - get encoder => const SongEncoder(); + SongEncoder get encoder => const SongEncoder(); @override - get decoder => const SongDecoder(); + SongDecoder get decoder => const SongDecoder(); static Song fromMap(Map map) { return Song( id: map['id'] as String?, @@ -1366,9 +1372,9 @@ class NumbaSerializer extends Codec { const NumbaSerializer(); @override - get encoder => const NumbaEncoder(); + NumbaEncoder get encoder => const NumbaEncoder(); @override - get decoder => const NumbaDecoder(); + NumbaDecoder get decoder => const NumbaDecoder(); static Numba fromMap(Map map) { return Numba(i: map['i'] as int?, parent: map['parent'] as int?); } @@ -1409,9 +1415,9 @@ class FooSerializer extends Codec { const FooSerializer(); @override - get encoder => const FooEncoder(); + FooEncoder get encoder => const FooEncoder(); @override - get decoder => const FooDecoder(); + FooDecoder get decoder => const FooDecoder(); static Foo fromMap(Map map) { return Foo( bar: map['bar'] as String?, @@ -1462,9 +1468,9 @@ class FooPivotSerializer extends Codec { const FooPivotSerializer(); @override - get encoder => const FooPivotEncoder(); + FooPivotEncoder get encoder => const FooPivotEncoder(); @override - get decoder => const FooPivotDecoder(); + FooPivotDecoder get decoder => const FooPivotDecoder(); static FooPivot fromMap(Map map) { return FooPivot( weirdJoin: map['weird_join'] != null diff --git a/packages/orm/angel_orm_test/lib/src/models/user.g.dart b/packages/orm/angel_orm_test/lib/src/models/user.g.dart index aece2150..11d1bf92 100644 --- a/packages/orm/angel_orm_test/lib/src/models/user.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/user.g.dart @@ -8,9 +8,9 @@ part of angel3_orm_generator.test.models.user; class UserMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('users', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); table.varChar('username'); @@ -20,14 +20,14 @@ class UserMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('users', cascade: true); } } class RoleUserMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('role_users', (table) { table.declare('role_id', ColumnType('serial')).references('roles', 'id'); table.declare('user_id', ColumnType('serial')).references('users', 'id'); @@ -35,16 +35,16 @@ class RoleUserMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('role_users'); } } class RoleMigration extends Migration { @override - up(Schema schema) { + void up(Schema schema) { schema.create('roles', (table) { - table.serial('id')..primaryKey(); + table.serial('id').primaryKey(); table.timeStamp('created_at'); table.timeStamp('updated_at'); table.varChar('name'); @@ -52,7 +52,7 @@ class RoleMigration extends Migration { } @override - down(Schema schema) { + void down(Schema schema) { schema.drop('roles', cascade: true); } } @@ -63,7 +63,7 @@ class RoleMigration extends Migration { class UserQuery extends Query { UserQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = UserQueryWhere(this); leftJoin( @@ -80,17 +80,17 @@ class UserQuery extends Query { UserQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'users'; } @override - get fields { + List get fields { return const [ 'id', 'created_at', @@ -143,7 +143,7 @@ class UserQuery extends Query { } @override - get(QueryExecutor executor) { + Future> get(QueryExecutor executor) { return super.get(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.id == model.id); @@ -161,7 +161,7 @@ class UserQuery extends Query { } @override - update(QueryExecutor executor) { + Future> update(QueryExecutor executor) { return super.update(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.id == model.id); @@ -179,7 +179,7 @@ class UserQuery extends Query { } @override - delete(QueryExecutor executor) { + Future> delete(QueryExecutor executor) { return super.delete(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.id == model.id); @@ -219,14 +219,14 @@ class UserQueryWhere extends QueryWhere { final StringSqlExpressionBuilder email; @override - get expressionBuilders { + List get expressionBuilders { return [id, createdAt, updatedAt, username, password, email]; } } class UserQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -272,7 +272,7 @@ class UserQueryValues extends MapQueryValues { class RoleUserQuery extends Query { RoleUserQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = RoleUserQueryWhere(this); leftJoin(_role = RoleQuery(trampoline: trampoline, parent: this), 'role_id', @@ -302,17 +302,17 @@ class RoleUserQuery extends Query { UserQuery? _user; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'role_users'; } @override - get fields { + List get fields { return const ['role_id', 'user_id']; } @@ -370,14 +370,14 @@ class RoleUserQueryWhere extends QueryWhere { final NumericSqlExpressionBuilder userId; @override - get expressionBuilders { + List get expressionBuilders { return [roleId, userId]; } } class RoleUserQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -403,7 +403,7 @@ class RoleUserQueryValues extends MapQueryValues { class RoleQuery extends Query { RoleQuery({Query? parent, Set? trampoline}) : super(parent: parent) { - trampoline ??= Set(); + trampoline ??= {}; trampoline.add(tableName); _where = RoleQueryWhere(this); leftJoin( @@ -427,17 +427,17 @@ class RoleQuery extends Query { RoleQueryWhere? _where; @override - get casts { + Map get casts { return {}; } @override - get tableName { + String get tableName { return 'roles'; } @override - get fields { + List get fields { return const ['id', 'created_at', 'updated_at', 'name']; } @@ -481,7 +481,7 @@ class RoleQuery extends Query { } @override - get(QueryExecutor executor) { + Future> get(QueryExecutor executor) { return super.get(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.id == model.id); @@ -499,7 +499,7 @@ class RoleQuery extends Query { } @override - update(QueryExecutor executor) { + Future> update(QueryExecutor executor) { return super.update(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.id == model.id); @@ -517,7 +517,7 @@ class RoleQuery extends Query { } @override - delete(QueryExecutor executor) { + Future> delete(QueryExecutor executor) { return super.delete(executor).then((result) { return result.fold>([], (out, model) { var idx = out.indexWhere((m) => m.id == model.id); @@ -551,14 +551,14 @@ class RoleQueryWhere extends QueryWhere { final StringSqlExpressionBuilder name; @override - get expressionBuilders { + List get expressionBuilders { return [id, createdAt, updatedAt, name]; } } class RoleQueryValues extends MapQueryValues { @override - get casts { + Map get casts { return {}; } @@ -603,7 +603,7 @@ class User extends _User { this.password, this.email, List<_Role> roles = const []}) - : this.roles = List.unmodifiable(roles); + : roles = List.unmodifiable(roles); /// A unique identifier corresponding to this item. @override @@ -647,6 +647,7 @@ class User extends _User { roles: roles); } + @override bool operator ==(other) { return other is _User && other.id == id && @@ -667,7 +668,7 @@ class User extends _User { @override String toString() { - return "User(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, username=$username, password=$password, email=$email, roles=$roles)"; + return 'User(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, username=$username, password=$password, email=$email, roles=$roles)'; } Map? toJson() { @@ -689,6 +690,7 @@ class RoleUser implements _RoleUser { return RoleUser(role: role ?? this.role, user: user ?? this.user); } + @override bool operator ==(other) { return other is _RoleUser && other.role == role && other.user == user; } @@ -700,7 +702,7 @@ class RoleUser implements _RoleUser { @override String toString() { - return "RoleUser(role=$role, user=$user)"; + return 'RoleUser(role=$role, user=$user)'; } Map toJson() { @@ -712,7 +714,7 @@ class RoleUser implements _RoleUser { class Role extends _Role { Role( {this.id, this.createdAt, this.updatedAt, this.name, List<_User?>? users}) - : this.users = List.unmodifiable(users ?? []); + : users = List.unmodifiable(users ?? []); /// A unique identifier corresponding to this item. @override @@ -746,6 +748,7 @@ class Role extends _Role { users: users ?? this.users); } + @override bool operator ==(other) { return other is _Role && other.id == id && @@ -763,7 +766,7 @@ class Role extends _Role { @override String toString() { - return "Role(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, name=$name, users=$users)"; + return 'Role(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, name=$name, users=$users)'; } Map? toJson() { @@ -795,9 +798,9 @@ class UserSerializer extends Codec { const UserSerializer(); @override - get encoder => const UserEncoder(); + UserEncoder get encoder => const UserEncoder(); @override - get decoder => const UserDecoder(); + UserDecoder get decoder => const UserDecoder(); static User fromMap(Map map) { return User( id: map['id'] as String?, @@ -882,9 +885,9 @@ class RoleUserSerializer extends Codec { const RoleUserSerializer(); @override - get encoder => const RoleUserEncoder(); + RoleUserEncoder get encoder => const RoleUserEncoder(); @override - get decoder => const RoleUserDecoder(); + RoleUserDecoder get decoder => const RoleUserDecoder(); static RoleUser fromMap(Map map) { return RoleUser( role: map['role'] != null @@ -931,9 +934,9 @@ class RoleSerializer extends Codec { const RoleSerializer(); @override - get encoder => const RoleEncoder(); + RoleEncoder get encoder => const RoleEncoder(); @override - get decoder => const RoleDecoder(); + RoleDecoder get decoder => const RoleDecoder(); static Role fromMap(Map map) { return Role( id: map['id'] as String?, diff --git a/packages/orm/angel_orm_test/lib/src/standalone_test.dart b/packages/orm/angel_orm_test/lib/src/standalone_test.dart index ef1f33c3..f35357a5 100644 --- a/packages/orm/angel_orm_test/lib/src/standalone_test.dart +++ b/packages/orm/angel_orm_test/lib/src/standalone_test.dart @@ -5,7 +5,7 @@ import 'models/car.dart'; final DateTime y2k = DateTime.utc(2000, 1, 1); -standaloneTests(FutureOr Function() createExecutor, +void standaloneTests(FutureOr Function() createExecutor, {FutureOr Function(QueryExecutor)? close}) { close ??= (_) => null; test('to where', () { @@ -52,7 +52,7 @@ standaloneTests(FutureOr Function() createExecutor, group('selects', () { test('select all', () async { - List cars = await CarQuery().get(executor); + var cars = await CarQuery().get(executor); expect(cars, []); }); @@ -70,7 +70,7 @@ standaloneTests(FutureOr Function() createExecutor, test('where clause is applied', () async { var query = CarQuery()..where!.familyFriendly.isTrue; - List cars = await query.get(executor); + var cars = await query.get(executor); expect(cars, isEmpty); var sportsCars = CarQuery()..where!.familyFriendly.isFalse; @@ -88,8 +88,8 @@ standaloneTests(FutureOr Function() createExecutor, var query1 = CarQuery()..where?.make.like('%Fer%'); var query2 = CarQuery()..where?.familyFriendly.isTrue; var query3 = CarQuery()..where?.description.equals('Submarine'); - Union union = query1.union(query2).unionAll(query3); - print(union.compile(Set())); + var union = query1.union(query2).unionAll(query3); + print(union.compile({})); var cars = await union.get(executor); expect(cars, hasLength(1)); }); @@ -100,15 +100,15 @@ standaloneTests(FutureOr Function() createExecutor, ..orWhere((where) => where ..familyFriendly.isTrue ..make.equals('Honda')); - print(query.compile(Set())); - List cars = await query.get(executor); + print(query.compile({})); + var cars = await query.get(executor); expect(cars, hasLength(1)); }); test('limit obeyed', () async { var query = CarQuery()..limit(0); - print(query.compile(Set())); - List cars = await query.get(executor); + print(query.compile({})); + var cars = await query.get(executor); expect(cars, isEmpty); }); @@ -132,7 +132,7 @@ standaloneTests(FutureOr Function() createExecutor, expect(car.toJson(), ferrari!.toJson()); }); - List cars = await CarQuery().get(executor); + var cars = await CarQuery().get(executor); expect(cars, isEmpty); }); @@ -140,9 +140,9 @@ standaloneTests(FutureOr Function() createExecutor, var query = CarQuery() ..where!.make.equals('Ferrarię±') ..orWhere((w) => w.familyFriendly.isTrue); - print(query.compile(Set(), preamble: 'DELETE FROM "cars"')); + print(query.compile({}, preamble: 'DELETE FROM "cars"')); - List cars = await query.delete(executor); + var cars = await query.delete(executor); expect(cars, hasLength(1)); expect(cars.first.toJson(), ferrari!.toJson()); }); @@ -151,7 +151,7 @@ standaloneTests(FutureOr Function() createExecutor, var query = CarQuery() ..where!.id.equals(int.parse(ferrari!.id!)) ..values.make = 'Hyundai'; - List cars = await query.update(executor); + var cars = await query.update(executor); expect(cars, hasLength(1)); expect(cars.first.make, 'Hyundai'); }); diff --git a/packages/orm/angel_orm_test/lib/src/util.dart b/packages/orm/angel_orm_test/lib/src/util.dart index eadc05b0..897050af 100644 --- a/packages/orm/angel_orm_test/lib/src/util.dart +++ b/packages/orm/angel_orm_test/lib/src/util.dart @@ -3,10 +3,10 @@ import 'package:io/ansi.dart'; void printSeparator(String title) { var b = StringBuffer('===' + title.toUpperCase()); - for (int i = b.length; i < stdout.terminalColumns - 3; i++) { + for (var i = b.length; i < stdout.terminalColumns - 3; i++) { b.write('='); } - for (int i = 0; i < 3; i++) { + for (var i = 0; i < 3; i++) { print(magenta.wrap(b.toString())); } } diff --git a/packages/relations/lib/src/belongs_to.dart b/packages/relations/lib/src/belongs_to.dart index 6972801e..bf05f84c 100644 --- a/packages/relations/lib/src/belongs_to.dart +++ b/packages/relations/lib/src/belongs_to.dart @@ -56,7 +56,7 @@ HookedServiceEventListener belongsTo(Pattern servicePath, 'query': {foreignKey ?? 'id': id} }); - if (indexed == null || indexed is! List || indexed.isNotEmpty != true) { + if (indexed is! List || indexed.isNotEmpty != true) { await _assignForeignObject(null, obj); } else { var child = indexed.first; diff --git a/packages/relations/lib/src/belongs_to_many.dart b/packages/relations/lib/src/belongs_to_many.dart index 65b65840..7ee4d2f9 100644 --- a/packages/relations/lib/src/belongs_to_many.dart +++ b/packages/relations/lib/src/belongs_to_many.dart @@ -56,7 +56,7 @@ HookedServiceEventListener belongsToMany(Pattern servicePath, 'query': {foreignKey ?? 'id': id} }); - if (indexed == null || indexed is! List || indexed.isNotEmpty != true) { + if (indexed is! List || indexed.isNotEmpty != true) { await _assignForeignObject(null, obj); } else { var child = indexed is Iterable ? indexed.toList() : [indexed]; diff --git a/packages/relations/test/belongs_to_test.dart b/packages/relations/test/belongs_to_test.dart index a1118a0e..06e2746a 100644 --- a/packages/relations/test/belongs_to_test.dart +++ b/packages/relations/test/belongs_to_test.dart @@ -1,5 +1,4 @@ import 'package:angel_framework/angel_framework.dart'; -import 'package:angel_relations/angel_relations.dart' as relations; import 'package:angel_seeder/angel_seeder.dart'; import 'package:test/test.dart'; import 'common.dart'; diff --git a/packages/relations/test/common.dart b/packages/relations/test/common.dart index 1e2969b0..b1d002e2 100644 --- a/packages/relations/test/common.dart +++ b/packages/relations/test/common.dart @@ -11,7 +11,7 @@ class CustomMapService extends Service { var r = items; - if (params != null && params['query'] is Map) { + if (params['query'] is Map) { var query = params['query'] as Map; for (var key in query.keys) { @@ -28,7 +28,7 @@ class CustomMapService extends Service { @override Future read(id, [Map? params]) async { return tailor(_items, params).firstWhere((m) => m['id'] == id, - orElse: (() => throw AngelHttpException.notFound()) as Map Function()?); + orElse: (() => throw AngelHttpException.notFound())); } @override diff --git a/packages/relations/test/has_one_test.dart b/packages/relations/test/has_one_test.dart index fc127ed8..d7535f40 100644 --- a/packages/relations/test/has_one_test.dart +++ b/packages/relations/test/has_one_test.dart @@ -1,5 +1,4 @@ import 'package:angel_framework/angel_framework.dart'; -import 'package:angel_relations/angel_relations.dart' as relations; import 'package:angel_seeder/angel_seeder.dart'; import 'package:test/test.dart'; import 'common.dart'; @@ -36,7 +35,7 @@ void main() { expect(authors, allOf(isList, isNotEmpty)); - for (Map author in authors.whereType()) { + for (var author in authors.whereType()) { expect(author.keys, contains('book')); var book = author['book'] as Map; diff --git a/packages/rethink/test/bootstrap.dart b/packages/rethink/test/bootstrap.dart index d1f73890..8782d8ab 100644 --- a/packages/rethink/test/bootstrap.dart +++ b/packages/rethink/test/bootstrap.dart @@ -1,9 +1,9 @@ import 'dart:io'; import 'package:rethinkdb_dart/rethinkdb_dart.dart'; -main() async { - var r = new Rethinkdb(); - r.connect().then((conn) { +void main() async { + var r = Rethinkdb(); + await r.connect().then((conn) { r.tableCreate('todos').run(conn); print('Done'); exit(0); diff --git a/packages/rethink/test/common.dart b/packages/rethink/test/common.dart index 15a4b813..ba2e5f4b 100644 --- a/packages/rethink/test/common.dart +++ b/packages/rethink/test/common.dart @@ -2,7 +2,7 @@ class Todo { String title; bool completed; - Todo({this.title, this.completed: false}); + Todo({this.title, this.completed = false}); Map toJson() { return {'title': title, 'completed': completed == true}; diff --git a/packages/rethink/test/generic_test.dart b/packages/rethink/test/generic_test.dart index 4a3d76e2..b2da9856 100644 --- a/packages/rethink/test/generic_test.dart +++ b/packages/rethink/test/generic_test.dart @@ -7,7 +7,7 @@ import 'package:rethinkdb_dart/rethinkdb_dart.dart'; import 'package:test/test.dart'; import 'common.dart'; -main() { +void main() { Angel app; TestClient client; Rethinkdb r; diff --git a/packages/route/lib/browser.dart b/packages/route/lib/browser.dart index d3893867..39596816 100644 --- a/packages/route/lib/browser.dart +++ b/packages/route/lib/browser.dart @@ -23,7 +23,7 @@ abstract class BrowserRouter extends Router { : _PushStateRouter(listen: listen); } - BrowserRouter._() : super(); + //BrowserRouter._() : super(); void _goTo(String path); diff --git a/packages/route/lib/src/middleware_pipeline.dart b/packages/route/lib/src/middleware_pipeline.dart index c5a4ad60..57c8db02 100644 --- a/packages/route/lib/src/middleware_pipeline.dart +++ b/packages/route/lib/src/middleware_pipeline.dart @@ -31,7 +31,7 @@ class MiddlewarePipeline { } MiddlewarePipeline(Iterable> routingResults) - : this.routingResults = routingResults.toList(); + : routingResults = routingResults.toList(); } /// Iterates through a [MiddlewarePipeline]. diff --git a/packages/route/test/server_test.dart b/packages/route/test/server_test.dart index 4588cf43..bbe26e80 100644 --- a/packages/route/test/server_test.dart +++ b/packages/route/test/server_test.dart @@ -182,7 +182,7 @@ void main() { }); group('404', () { - expect404(r) => r.then((res) { + dynamic expect404(r) => r.then((res) { print('Response (${res.statusCode}): ${res.body}'); expect(res.statusCode, equals(404)); }); diff --git a/packages/security/lib/src/service_rate_limiter.dart b/packages/security/lib/src/service_rate_limiter.dart index 2ac413fd..85ea0e01 100644 --- a/packages/security/lib/src/service_rate_limiter.dart +++ b/packages/security/lib/src/service_rate_limiter.dart @@ -23,9 +23,7 @@ class ServiceRateLimiter extends RateLimiter { var id = await getId(req, res); try { var data = await service.read(id); - if (data != null) { - return RateLimitingWindow.fromJson(data); - } + return RateLimitingWindow.fromJson(data); } catch (e) { if (e is AngelHttpException) { if (e.statusCode == 404) { diff --git a/packages/seeder/test/all_test.dart b/packages/seeder/test/all_test.dart index 9cecfa97..8d6f4af5 100644 --- a/packages/seeder/test/all_test.dart +++ b/packages/seeder/test/all_test.dart @@ -55,7 +55,7 @@ class Todo extends Model { final String? text; final bool? completed; - Todo({String? id, this.text, this.completed: false}) { + Todo({String? id, this.text, this.completed = false}) { this.id = id; } diff --git a/packages/serialize/angel_serialize_generator/test/models/book.dart b/packages/serialize/angel_serialize_generator/test/models/book.dart index 271eb9f1..45cfc2e1 100644 --- a/packages/serialize/angel_serialize_generator/test/models/book.dart +++ b/packages/serialize/angel_serialize_generator/test/models/book.dart @@ -3,7 +3,6 @@ library angel_serialize.test.models.book; import 'package:angel3_model/angel3_model.dart'; import 'package:angel3_serialize/angel3_serialize.dart'; import 'package:collection/collection.dart'; -import 'package:meta/meta.dart'; part 'book.g.dart'; @Serializable( diff --git a/packages/serialize/angel_serialize_generator/test/models/book.g.dart b/packages/serialize/angel_serialize_generator/test/models/book.g.dart index 51280621..05845c2d 100644 --- a/packages/serialize/angel_serialize_generator/test/models/book.g.dart +++ b/packages/serialize/angel_serialize_generator/test/models/book.g.dart @@ -20,7 +20,7 @@ class Book extends _Book { this.pageCount, List? notModels, this.camelCaseString}) - : this.notModels = List.unmodifiable(notModels ?? []); + : notModels = List.unmodifiable(notModels ?? []); /// A unique identifier corresponding to this item. @override @@ -75,6 +75,7 @@ class Book extends _Book { camelCaseString: camelCaseString ?? this.camelCaseString); } + @override bool operator ==(other) { return other is _Book && other.id == id && @@ -126,7 +127,7 @@ class Author extends _Author { this.newestBook, this.secret, this.obscured}) - : this.books = List.unmodifiable(books ?? []); + : books = List.unmodifiable(books ?? []); /// A unique identifier corresponding to this item. @override @@ -181,6 +182,7 @@ class Author extends _Author { obscured: obscured ?? this.obscured); } + @override bool operator ==(other) { return other is _Author && other.id == id && @@ -253,6 +255,7 @@ class Library extends _Library { collection: collection ?? this.collection); } + @override bool operator ==(other) { return other is _Library && other.id == id && @@ -328,6 +331,7 @@ class Bookmark extends _Bookmark { comment: comment ?? this.comment); } + @override bool operator ==(other) { return other is _Bookmark && other.id == id && diff --git a/packages/serialize/angel_serialize_generator/test/models/game_pad_button.g.dart b/packages/serialize/angel_serialize_generator/test/models/game_pad_button.g.dart index 7d39a8f1..2559c257 100644 --- a/packages/serialize/angel_serialize_generator/test/models/game_pad_button.g.dart +++ b/packages/serialize/angel_serialize_generator/test/models/game_pad_button.g.dart @@ -21,6 +21,7 @@ class GamepadButton implements _GamepadButton { name: name ?? this.name, radius: radius ?? this.radius); } + @override bool operator ==(other) { return other is _GamepadButton && other.name == name && @@ -34,7 +35,7 @@ class GamepadButton implements _GamepadButton { @override String toString() { - return "GamepadButton(name=$name, radius=$radius)"; + return 'GamepadButton(name=$name, radius=$radius)'; } Map toJson() { @@ -45,8 +46,8 @@ class GamepadButton implements _GamepadButton { @generatedSerializable class Gamepad extends _Gamepad { Gamepad({List<_GamepadButton>? buttons, Map? dynamicMap}) - : this.buttons = List.unmodifiable(buttons ?? []), - this.dynamicMap = Map.unmodifiable(dynamicMap ?? {}); + : buttons = List.unmodifiable(buttons ?? []), + dynamicMap = Map.unmodifiable(dynamicMap ?? {}); @override List<_GamepadButton>? buttons; @@ -61,6 +62,7 @@ class Gamepad extends _Gamepad { dynamicMap: dynamicMap ?? this.dynamicMap); } + @override bool operator ==(other) { return other is _Gamepad && ListEquality<_GamepadButton>(DefaultEquality<_GamepadButton>()) @@ -77,7 +79,7 @@ class Gamepad extends _Gamepad { @override String toString() { - return "Gamepad(buttons=$buttons, dynamicMap=$dynamicMap)"; + return 'Gamepad(buttons=$buttons, dynamicMap=$dynamicMap)'; } Map toJson() { @@ -110,9 +112,9 @@ class GamepadButtonSerializer extends Codec { const GamepadButtonSerializer(); @override - get encoder => const GamepadButtonEncoder(); + GamepadButtonEncoder get encoder => const GamepadButtonEncoder(); @override - get decoder => const GamepadButtonDecoder(); + GamepadButtonDecoder get decoder => const GamepadButtonDecoder(); static GamepadButton fromMap(Map map) { return GamepadButton( name: map['name'] as String?, radius: map['radius'] as int?); @@ -151,9 +153,9 @@ class GamepadSerializer extends Codec { const GamepadSerializer(); @override - get encoder => const GamepadEncoder(); + GamepadEncoder get encoder => const GamepadEncoder(); @override - get decoder => const GamepadDecoder(); + GamepadDecoder get decoder => const GamepadDecoder(); static Gamepad fromMap(Map map) { return Gamepad( buttons: map['buttons'] is Iterable diff --git a/packages/serialize/angel_serialize_generator/test/models/goat.g.dart b/packages/serialize/angel_serialize_generator/test/models/goat.g.dart index 09097976..ead0a156 100644 --- a/packages/serialize/angel_serialize_generator/test/models/goat.g.dart +++ b/packages/serialize/angel_serialize_generator/test/models/goat.g.dart @@ -20,6 +20,7 @@ class Goat implements _Goat { return Goat(integer: integer ?? this.integer, list: list ?? this.list); } + @override bool operator ==(other) { return other is _Goat && other.integer == integer && @@ -33,7 +34,7 @@ class Goat implements _Goat { @override String toString() { - return "Goat(integer=$integer, list=$list)"; + return 'Goat(integer=$integer, list=$list)'; } Map toJson() { @@ -65,9 +66,9 @@ class GoatSerializer extends Codec { const GoatSerializer(); @override - get encoder => const GoatEncoder(); + GoatEncoder get encoder => const GoatEncoder(); @override - get decoder => const GoatDecoder(); + GoatDecoder get decoder => const GoatDecoder(); static Goat fromMap(Map map) { return Goat( integer: map['integer'] as int? ?? 34, diff --git a/packages/serialize/angel_serialize_generator/test/models/has_map.g.dart b/packages/serialize/angel_serialize_generator/test/models/has_map.g.dart index 5dcc47af..25416576 100644 --- a/packages/serialize/angel_serialize_generator/test/models/has_map.g.dart +++ b/packages/serialize/angel_serialize_generator/test/models/has_map.g.dart @@ -17,6 +17,7 @@ class HasMap implements _HasMap { return HasMap(value: value ?? this.value); } + @override bool operator ==(other) { return other is _HasMap && MapEquality( @@ -31,7 +32,7 @@ class HasMap implements _HasMap { @override String toString() { - return "HasMap(value=$value)"; + return 'HasMap(value=$value)'; } Map toJson() { @@ -63,9 +64,9 @@ class HasMapSerializer extends Codec { const HasMapSerializer(); @override - get encoder => const HasMapEncoder(); + HasMapEncoder get encoder => const HasMapEncoder(); @override - get decoder => const HasMapDecoder(); + HasMapDecoder get decoder => const HasMapDecoder(); static HasMap fromMap(Map map) { if (map['value'] == null) { throw FormatException("Missing required field 'value' on HasMap."); diff --git a/packages/serialize/angel_serialize_generator/test/models/subclass.g.dart b/packages/serialize/angel_serialize_generator/test/models/subclass.g.dart index 77e2b20c..611401f1 100644 --- a/packages/serialize/angel_serialize_generator/test/models/subclass.g.dart +++ b/packages/serialize/angel_serialize_generator/test/models/subclass.g.dart @@ -20,6 +20,7 @@ class Animal extends _Animal { return Animal(genus: genus ?? this.genus, species: species ?? this.species); } + @override bool operator ==(other) { return other is _Animal && other.genus == genus && other.species == species; } @@ -31,7 +32,7 @@ class Animal extends _Animal { @override String toString() { - return "Animal(genus=$genus, species=$species)"; + return 'Animal(genus=$genus, species=$species)'; } Map toJson() { @@ -59,6 +60,7 @@ class Bird extends _Bird { isSparrow: isSparrow ?? this.isSparrow); } + @override bool operator ==(other) { return other is _Bird && other.genus == genus && @@ -73,7 +75,7 @@ class Bird extends _Bird { @override String toString() { - return "Bird(genus=$genus, species=$species, isSparrow=$isSparrow)"; + return 'Bird(genus=$genus, species=$species, isSparrow=$isSparrow)'; } Map toJson() { @@ -105,9 +107,9 @@ class AnimalSerializer extends Codec { const AnimalSerializer(); @override - get encoder => const AnimalEncoder(); + AnimalEncoder get encoder => const AnimalEncoder(); @override - get decoder => const AnimalDecoder(); + AnimalDecoder get decoder => const AnimalDecoder(); static Animal fromMap(Map map) { if (map['genus'] == null) { throw FormatException("Missing required field 'genus' on Animal."); @@ -162,9 +164,9 @@ class BirdSerializer extends Codec { const BirdSerializer(); @override - get encoder => const BirdEncoder(); + BirdEncoder get encoder => const BirdEncoder(); @override - get decoder => const BirdDecoder(); + BirdDecoder get decoder => const BirdDecoder(); static Bird fromMap(Map map) { if (map['genus'] == null) { throw FormatException("Missing required field 'genus' on Bird."); diff --git a/packages/serialize/angel_serialize_generator/test/models/with_enum.g.dart b/packages/serialize/angel_serialize_generator/test/models/with_enum.g.dart index 700b788c..f2446c6c 100644 --- a/packages/serialize/angel_serialize_generator/test/models/with_enum.g.dart +++ b/packages/serialize/angel_serialize_generator/test/models/with_enum.g.dart @@ -27,6 +27,7 @@ class WithEnum implements _WithEnum { imageBytes: imageBytes ?? this.imageBytes); } + @override bool operator ==(other) { return other is _WithEnum && other.type == type && @@ -42,7 +43,7 @@ class WithEnum implements _WithEnum { @override String toString() { - return "WithEnum(type=$type, finalList=$finalList, imageBytes=$imageBytes)"; + return 'WithEnum(type=$type, finalList=$finalList, imageBytes=$imageBytes)'; } Map toJson() { @@ -74,9 +75,9 @@ class WithEnumSerializer extends Codec { const WithEnumSerializer(); @override - get encoder => const WithEnumEncoder(); + WithEnumEncoder get encoder => const WithEnumEncoder(); @override - get decoder => const WithEnumDecoder(); + WithEnumDecoder get decoder => const WithEnumDecoder(); static WithEnum fromMap(Map map) { return WithEnum( type: map['type'] is WithEnumType diff --git a/packages/shelf/example/main.dart b/packages/shelf/example/main.dart index 6a7b0fb5..f6c923e4 100644 --- a/packages/shelf/example/main.dart +++ b/packages/shelf/example/main.dart @@ -6,7 +6,7 @@ import 'package:logging/logging.dart'; import 'package:pretty_logging/pretty_logging.dart'; import 'package:shelf_static/shelf_static.dart'; -main() async { +void main() async { Logger.root ..level = Level.ALL ..onRecord.listen(prettyLog); diff --git a/packages/shelf/lib/src/embed_shelf.dart b/packages/shelf/lib/src/embed_shelf.dart index 7d1f9f09..3b2a6581 100644 --- a/packages/shelf/lib/src/embed_shelf.dart +++ b/packages/shelf/lib/src/embed_shelf.dart @@ -19,8 +19,8 @@ RequestHandler embedShelf(shelf.Handler handler, handlerPath: handlerPath, context: context); try { var result = await handler(shelfRequest); - if (result is! shelf.Response && result != null) return result; - if (result == null && throwOnNullResponse == true) { + if (result is! shelf.Response) return result; + if (throwOnNullResponse == true) { throw AngelHttpException('Internal Server Error'); } await mergeShelfResponse(result, res); diff --git a/packages/symbol_table/example/main.dart b/packages/symbol_table/example/main.dart index 0774ec51..5c804cf4 100644 --- a/packages/symbol_table/example/main.dart +++ b/packages/symbol_table/example/main.dart @@ -1,7 +1,7 @@ import 'package:angel3_symbol_table/angel3_symbol_table.dart'; void main(List args) { - var mySymbolTable = SymbolTable(); + //var mySymbolTable = SymbolTable(); var doubles = SymbolTable(values: {'hydrogen': 1.0, 'avogadro': 6.022e23}); @@ -17,10 +17,10 @@ void main(List args) { doubles.remove('two'); // Find a symbol, either in this symbol table or an ancestor. - var symbol1 = doubles.resolve('one'); + //var symbol1 = doubles.resolve('one'); // Find OR create a symbol. - var symbol2 = doubles.resolveOrCreate('one'); - var symbol3 = doubles.resolveOrCreate('one', value: 1.0); - var symbol4 = doubles.resolveOrCreate('one', value: 1.0, constant: true); + //var symbol2 = doubles.resolveOrCreate('one'); + //var symbol3 = doubles.resolveOrCreate('one', value: 1.0); + //var symbol4 = doubles.resolveOrCreate('one', value: 1.0, constant: true); } diff --git a/packages/validate/test/basic_test.dart b/packages/validate/test/basic_test.dart index 031f7392..c40a6a41 100644 --- a/packages/validate/test/basic_test.dart +++ b/packages/validate/test/basic_test.dart @@ -13,7 +13,7 @@ final Validator todoSchema = Validator({ 'completed': false }); -main() { +void main() { test('custom error message', () { var result = emailSchema.check({'to': 2}); diff --git a/packages/wings/benchmark/util.dart b/packages/wings/benchmark/util.dart index 2bece6c3..e51f8bcd 100644 --- a/packages/wings/benchmark/util.dart +++ b/packages/wings/benchmark/util.dart @@ -75,6 +75,7 @@ Future runBenchmarks(Iterable benchmarks, exit(0); } +/* void _httpIsolate(AngelBenchmark benchmark) { Future(() async { var raw = await HttpServer.bind(InternetAddress.loopbackIPv4, testPort, @@ -82,6 +83,7 @@ void _httpIsolate(AngelBenchmark benchmark) { raw.listen((r) => benchmark.rawHandler(r, r.response)); }); } +*/ void _angelIsolate(Tuple2 args) { Future(() async { diff --git a/packages/wings/lib/src/wings_request.dart b/packages/wings/lib/src/wings_request.dart index 5d1c08b4..90781169 100644 --- a/packages/wings/lib/src/wings_request.dart +++ b/packages/wings/lib/src/wings_request.dart @@ -7,7 +7,7 @@ import 'package:angel_framework/angel_framework.dart'; import 'package:mock_request/mock_request.dart'; import 'wings_socket.dart'; -enum _ParseState { method, url, headerField, headerValue, body } +//enum _ParseState { method, url, headerField, headerValue, body } final RegExp _straySlashes = RegExp(r'(^/+)|(/+$)'); diff --git a/packages/wings/lib/src/wings_response.dart b/packages/wings/lib/src/wings_response.dart index add6ea7c..2747a829 100644 --- a/packages/wings/lib/src/wings_response.dart +++ b/packages/wings/lib/src/wings_response.dart @@ -57,9 +57,7 @@ class WingsResponseContext extends ResponseContext { } } - if (contentType != null) { - outHeaders['content-type'] = contentType.toString(); - } + outHeaders['content-type'] = contentType.toString(); if (encoders.isNotEmpty && correspondingRequest != null) { if (_allowedEncodings != null) {