diff --git a/packages/orm/angel_migration_runner/pubspec.yaml b/packages/orm/angel_migration_runner/pubspec.yaml index 1c40032c..9320dd27 100755 --- a/packages/orm/angel_migration_runner/pubspec.yaml +++ b/packages/orm/angel_migration_runner/pubspec.yaml @@ -1,21 +1,12 @@ -name: angel_migration_runner -version: 4.0.0 +name: angel3_migration_runner +version: 4.0.0-beta.1 description: Command-line based database migration runner for Angel's ORM. -homepage: https://github.com/dukefirehawk/angel -publish_to: none +homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel3_migration_runner environment: sdk: '>=2.12.0 <3.0.0' dependencies: - angel_migration: - git: - url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x_nnbd - path: packages/orm/angel_migration - angel_orm: - git: - url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x_nnbd - path: packages/orm/angel_orm + angel3_migration: ^4.0.0-beta.1 + angel3_orm: ^4.0.0 args: ^2.1.0 charcode: ^1.2.0 postgres: ^2.3.2 diff --git a/packages/serialize/angel_serialize_generator/CHANGELOG.md b/packages/serialize/angel_serialize_generator/CHANGELOG.md index 81248792..90ec2077 100644 --- a/packages/serialize/angel_serialize_generator/CHANGELOG.md +++ b/packages/serialize/angel_serialize_generator/CHANGELOG.md @@ -1,3 +1,6 @@ +# 4.0.1 +* Resolved static analysis warnings + # 4.0.0 * Migrated to support Dart SDK 2.12.x NNBD diff --git a/packages/serialize/angel_serialize_generator/README.md b/packages/serialize/angel_serialize_generator/README.md index 42964df9..e3c884b4 100644 --- a/packages/serialize/angel_serialize_generator/README.md +++ b/packages/serialize/angel_serialize_generator/README.md @@ -1,5 +1,5 @@ # angel3_serialize_generator -[![version](https://img.shields.io/badge/pub-v4.0.0-brightgreen)](https://pub.dartlang.org/packages/angel3_serialize_generator) +[![version](https://img.shields.io/badge/pub-v4.0.1-brightgreen)](https://pub.dartlang.org/packages/angel3_serialize_generator) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion) diff --git a/packages/serialize/angel_serialize_generator/lib/model.dart b/packages/serialize/angel_serialize_generator/lib/model.dart index d2218bc6..d8450ff4 100644 --- a/packages/serialize/angel_serialize_generator/lib/model.dart +++ b/packages/serialize/angel_serialize_generator/lib/model.dart @@ -11,7 +11,7 @@ class JsonModelGenerator extends GeneratorForAnnotation { } var ctx = await buildContext(element as ClassElement, annotation, buildStep, - await buildStep.resolver, true); + buildStep.resolver, true); var lib = Library((b) { generateClass(ctx, b, annotation); @@ -180,7 +180,7 @@ class JsonModelGenerator extends GeneratorForAnnotation { } var buf = StringBuffer('return ${ctx.modelClassName}('); - int i = 0; + var i = 0; for (var param in ctx.constructorParameters) { if (i++ > 0) buf.write(', '); buf.write(param.name); @@ -240,18 +240,17 @@ class JsonModelGenerator extends GeneratorForAnnotation { } void generateHashCode(BuildContext? ctx, ClassBuilder clazz) { - clazz - ..methods.add(Method((method) { - method - ..name = 'hashCode' - ..type = MethodType.getter - ..returns = refer('int') - ..annotations.add(refer('override')) - ..body = refer('hashObjects') - .call([literalList(ctx!.fields.map((f) => refer(f.name)))]) - .returned - .statement; - })); + clazz.methods.add(Method((method) { + method + ..name = 'hashCode' + ..type = MethodType.getter + ..returns = refer('int') + ..annotations.add(refer('override')) + ..body = refer('hashObjects') + .call([literalList(ctx!.fields.map((f) => refer(f.name)))]) + .returned + .statement; + })); } void generateToString(BuildContext? ctx, ClassBuilder clazz) { diff --git a/packages/serialize/angel_serialize_generator/lib/serialize.dart b/packages/serialize/angel_serialize_generator/lib/serialize.dart index 35d78690..d6c1720c 100644 --- a/packages/serialize/angel_serialize_generator/lib/serialize.dart +++ b/packages/serialize/angel_serialize_generator/lib/serialize.dart @@ -154,12 +154,13 @@ class ${pascal}Decoder extends Converter { // Serialize model classes via `XSerializer.toMap` else if (isModelClass(type)) { - var rc = ReCase(type.name!); + var rc = ReCase(type.getDisplayString(withNullability: true)); serializedRepresentation = '${serializerToMap(rc, 'model.${field.name}')}'; } else if (type is InterfaceType) { if (isListOfModelType(type)) { - var name = type.typeArguments[0].name!; + var name = + type.typeArguments[0].getDisplayString(withNullability: true); if (name.startsWith('_')) name = name.substring(1); var rc = ReCase(name); var m = serializerToMap(rc, 'm'); @@ -168,7 +169,8 @@ class ${pascal}Decoder extends Converter { ?.map((m) => $m) ?.toList()'''; } else if (isMapToModelType(type)) { - var rc = ReCase(type.typeArguments[1].name!); + var rc = ReCase( + type.typeArguments[1].getDisplayString(withNullability: true)); serializedRepresentation = '''model.${field.name}.keys?.fold({}, (map, key) { return map..[key] = @@ -178,7 +180,7 @@ class ${pascal}Decoder extends Converter { serializedRepresentation = ''' model.${field.name} == null ? null - : ${type.name}.values.indexOf(model.${field.name}) + : ${type.getDisplayString(withNullability: true)}.values.indexOf(model.${field.name}) '''; } else if (const TypeChecker.fromRuntime(Uint8List) .isAssignableFromType(type)) { @@ -276,20 +278,22 @@ class ${pascal}Decoder extends Converter { // Serialize model classes via `XSerializer.toMap` else if (isModelClass(type)) { - var rc = ReCase(type.name!); + var rc = ReCase(type.getDisplayString(withNullability: true)); deserializedRepresentation = "map['$alias'] != null" " ? ${rc.pascalCase}Serializer.fromMap(map['$alias'] as Map)" ' : $defaultValue'; } else if (type is InterfaceType) { if (isListOfModelType(type)) { - var rc = ReCase(type.typeArguments[0].name!); + var rc = ReCase( + type.typeArguments[0].getDisplayString(withNullability: true)); deserializedRepresentation = "map['$alias'] is Iterable" " ? List.unmodifiable(((map['$alias'] as Iterable)" '.whereType())' '.map(${rc.pascalCase}Serializer.fromMap))' ' : $defaultValue'; } else if (isMapToModelType(type)) { - var rc = ReCase(type.typeArguments[1].name!); + var rc = ReCase( + type.typeArguments[1].getDisplayString(withNullability: true)); deserializedRepresentation = ''' map['$alias'] is Map ? Map.unmodifiable((map['$alias'] as Map).keys.fold({}, (out, key) { @@ -300,12 +304,12 @@ class ${pascal}Decoder extends Converter { '''; } else if (type.element.isEnum) { deserializedRepresentation = ''' - map['$alias'] is ${type.name} - ? (map['$alias'] as ${type.name}) + map['$alias'] is ${type.getDisplayString(withNullability: true)} + ? (map['$alias'] as ${type.getDisplayString(withNullability: true)}) : ( map['$alias'] is int - ? ${type.name}.values[map['$alias'] as int] + ? ${type.getDisplayString(withNullability: true)}.values[map['$alias'] as int] : $defaultValue ) '''; diff --git a/packages/serialize/angel_serialize_generator/pubspec.yaml b/packages/serialize/angel_serialize_generator/pubspec.yaml index 0eb43e23..b65c0053 100644 --- a/packages/serialize/angel_serialize_generator/pubspec.yaml +++ b/packages/serialize/angel_serialize_generator/pubspec.yaml @@ -1,5 +1,5 @@ name: angel3_serialize_generator -version: 4.0.0 +version: 4.0.1 description: Model serialization generators, designed for use with Angel. Combine with angel_serialize for flexible modeling. homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/serialize/angel_serialize_generator environment: