From 32a7e88d2db59f8e6217e44a8e52dbc23a973a21 Mon Sep 17 00:00:00 2001 From: Thomas Hii Date: Sun, 16 Jun 2024 10:13:53 +0800 Subject: [PATCH] Updated deprecated code --- packages/jael/jael_web/CHANGELOG.md | 19 ++++----------- packages/jael/jael_web/README.md | 2 +- .../jael/jael_web/lib/src/builder/util.dart | 2 +- .../jael/jael_web/lib/src/jael_component.dart | 3 +-- packages/jael/jael_web/pubspec.yaml | 2 +- packages/model/CHANGELOG.md | 5 ++++ packages/model/pubspec.yaml | 2 +- .../lib/angel3_serialize_generator.dart | 2 +- .../lib/serialize.dart | 24 ++++++++----------- 9 files changed, 26 insertions(+), 35 deletions(-) diff --git a/packages/jael/jael_web/CHANGELOG.md b/packages/jael/jael_web/CHANGELOG.md index 00e4635a..88a33592 100644 --- a/packages/jael/jael_web/CHANGELOG.md +++ b/packages/jael/jael_web/CHANGELOG.md @@ -1,21 +1,12 @@ # Change Log -## 8.2.1 - -* Updated repository link - -## 8.2.0 - -* Updated `lints` to 3.0.0 -* Fixed linter warnings - -## 8.1.0 - -* Upgraded to `analyzer` 6.2.x - ## 8.0.0 -* Require Dart >= 3.0 +* Require Dart >= 3.3 +* Updated `lints` to 3.0.0 +* Updated `analyzer` to 6.2.x +* Fixed linter warnings +* Updated repository link ## 7.1.1 diff --git a/packages/jael/jael_web/README.md b/packages/jael/jael_web/README.md index 8f812076..fc85bf5e 100644 --- a/packages/jael/jael_web/README.md +++ b/packages/jael/jael_web/README.md @@ -8,4 +8,4 @@ Experimental virtual DOM/SPA engine built on Jael. Supports SSR. ## TODO -* Builder failed to generate the class +* Bug: Builder failed to generate the class diff --git a/packages/jael/jael_web/lib/src/builder/util.dart b/packages/jael/jael_web/lib/src/builder/util.dart index 3518221f..d0a38b2c 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/path.dart'; /// Converts a [DartType] to a [TypeReference]. TypeReference convertTypeReference(DartType? t) { return TypeReference((b) { - b.symbol = t?.getDisplayString(withNullability: false); + b.symbol = t?.getDisplayString(); if (t is InterfaceType) { b.types.addAll(t.typeArguments.map(convertTypeReference)); diff --git a/packages/jael/jael_web/lib/src/jael_component.dart b/packages/jael/jael_web/lib/src/jael_component.dart index 702b81ec..e7bf67a8 100644 --- a/packages/jael/jael_web/lib/src/jael_component.dart +++ b/packages/jael/jael_web/lib/src/jael_component.dart @@ -14,6 +14,5 @@ class Jael { /// Shorthand for enabling `DSX` syntax when using a [Jael] annotation. class Dsx extends Jael { - const Dsx({String? template, String? templateUrl}) - : super(template: template, templateUrl: templateUrl, asDsx: true); + const Dsx({super.template, super.templateUrl}) : super(asDsx: true); } diff --git a/packages/jael/jael_web/pubspec.yaml b/packages/jael/jael_web/pubspec.yaml index 941a6297..0e3ff535 100644 --- a/packages/jael/jael_web/pubspec.yaml +++ b/packages/jael/jael_web/pubspec.yaml @@ -1,5 +1,5 @@ name: jael3_web -version: 8.2.0 +version: 8.0.0 description: Experimental virtual DOM/SPA engine built on Jael3. Supports SSR. publish_to: none environment: diff --git a/packages/model/CHANGELOG.md b/packages/model/CHANGELOG.md index 86374d8d..84cf9dde 100644 --- a/packages/model/CHANGELOG.md +++ b/packages/model/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 8.2.0 + +* Require Dart >= 3.3 +* Updated `lints` to 4.0.0 + ## 8.1.1 * Updated repository link diff --git a/packages/model/pubspec.yaml b/packages/model/pubspec.yaml index eae6093d..4a02e141 100644 --- a/packages/model/pubspec.yaml +++ b/packages/model/pubspec.yaml @@ -1,5 +1,5 @@ name: angel3_model -version: 8.1.1 +version: 8.2.0 description: Angel3 basic data model class, no longer with the added weight of the whole framework. homepage: https://angel3-framework.web.app/ repository: https://github.com/dart-backend/angel/tree/master/packages/model diff --git a/packages/serialize/angel_serialize_generator/lib/angel3_serialize_generator.dart b/packages/serialize/angel_serialize_generator/lib/angel3_serialize_generator.dart index d9914a5b..7dddddee 100644 --- a/packages/serialize/angel_serialize_generator/lib/angel3_serialize_generator.dart +++ b/packages/serialize/angel_serialize_generator/lib/angel3_serialize_generator.dart @@ -100,7 +100,7 @@ String? dartObjectToString(DartObject v) { return '#${v.toSymbolValue()!}'; } if (v.toTypeValue() != null) { - return v.toTypeValue()!.getDisplayString(withNullability: true); + return v.toTypeValue()!.getDisplayString(); } if (v.toListValue() != null) { return 'const [${v.toListValue()!.map(dartObjectToString).join(', ')}]'; diff --git a/packages/serialize/angel_serialize_generator/lib/serialize.dart b/packages/serialize/angel_serialize_generator/lib/serialize.dart index f7fa2328..5812d4a8 100644 --- a/packages/serialize/angel_serialize_generator/lib/serialize.dart +++ b/packages/serialize/angel_serialize_generator/lib/serialize.dart @@ -189,12 +189,11 @@ class ${pascal}Decoder extends Converter { // Serialize model classes via `XSerializer.toMap` else if (isModelClass(type)) { - var rc = ReCase(type.getDisplayString(withNullability: true)); + var rc = ReCase(type.getDisplayString()); serializedRepresentation = serializerToMap(rc, 'model.${field.name}'); } else if (type is InterfaceType) { if (isListOfModelType(type)) { - var name = - type.typeArguments[0].getDisplayString(withNullability: true); + var name = type.typeArguments[0].getDisplayString(); if (name.startsWith('_')) name = name.substring(1); var rc = ReCase(name); var m = serializerToMap(rc, 'm'); @@ -207,8 +206,7 @@ class ${pascal}Decoder extends Converter { 'model.${field.name}$question.map((m) => $m).toList()'; log.fine('serializedRepresentation => $serializedRepresentation'); } else if (isMapToModelType(type)) { - var rc = ReCase( - type.typeArguments[1].getDisplayString(withNullability: true)); + var rc = ReCase(type.typeArguments[1].getDisplayString()); serializedRepresentation = '''model.${field.name}.keys.fold({}, (map, key) { return map..[key] = @@ -222,7 +220,7 @@ class ${pascal}Decoder extends Converter { serializedRepresentation = ''' model.${field.name} != null ? - ${type.getDisplayString(withNullability: false)}.values.indexOf(model.${field.name}$convert) + ${type.getDisplayString()}.values.indexOf(model.${field.name}$convert) : null '''; } else if (const TypeChecker.fromRuntime(Uint8List) @@ -357,7 +355,7 @@ class ${pascal}Decoder extends Converter { // Serialize model classes via `XSerializer.toMap` else if (isModelClass(type)) { - var rc = ReCase(type.getDisplayString(withNullability: true)); + var rc = ReCase(type.getDisplayString()); deserializedRepresentation = "map['$alias'] != null" " ? ${rc.pascalCase.replaceAll('?', '')}Serializer.fromMap(map['$alias'] as Map)" ' : $defaultValue'; @@ -366,8 +364,7 @@ class ${pascal}Decoder extends Converter { if (defaultValue == 'null') { defaultValue = '[]'; } - var rc = ReCase( - type.typeArguments[0].getDisplayString(withNullability: true)); + var rc = ReCase(type.typeArguments[0].getDisplayString()); deserializedRepresentation = "map['$alias'] is Iterable" " ? List.unmodifiable(((map['$alias'] as Iterable)" @@ -380,8 +377,7 @@ class ${pascal}Decoder extends Converter { defaultValue = '{}'; } - var rc = ReCase( - type.typeArguments[1].getDisplayString(withNullability: true)); + var rc = ReCase(type.typeArguments[1].getDisplayString()); deserializedRepresentation = ''' map['$alias'] is Map ? Map.unmodifiable((map['$alias'] as Map).keys.fold({}, (out, key) { @@ -392,12 +388,12 @@ class ${pascal}Decoder extends Converter { '''; } else if (type.element is Enum) { deserializedRepresentation = ''' - map['$alias'] is ${type.getDisplayString(withNullability: true)} - ? (map['$alias'] as ${type.getDisplayString(withNullability: true)}) ?? $defaultValue + map['$alias'] is ${type.getDisplayString()} + ? (map['$alias'] as ${type.getDisplayString()}) ?? $defaultValue : ( map['$alias'] is int - ? ${type.getDisplayString(withNullability: true)}.values[map['$alias'] as int] + ? ${type.getDisplayString()}.values[map['$alias'] as int] : $defaultValue ) ''';