From 00b0304af17984f14facd8012c33c68d2e963730 Mon Sep 17 00:00:00 2001 From: thomashii Date: Sat, 10 Jun 2023 20:28:00 +0800 Subject: [PATCH] Removed deprecated code --- lib/src/commands/key.dart | 2 +- lib/src/commands/pub.dart | 2 +- lib/src/commands/rename.dart | 8 ++++---- lib/src/commands/service_generators/custom.dart | 2 -- .../commands/service_generators/generator.dart | 15 --------------- lib/src/commands/service_generators/map.dart | 1 - lib/src/commands/service_generators/mongo.dart | 1 - lib/src/commands/service_generators/rethink.dart | 1 - 8 files changed, 6 insertions(+), 26 deletions(-) diff --git a/lib/src/commands/key.dart b/lib/src/commands/key.dart index 2fc89d6..eade104 100644 --- a/lib/src/commands/key.dart +++ b/lib/src/commands/key.dart @@ -24,7 +24,7 @@ class KeyCommand extends Command { if (await file.exists()) { var contents = await file.readAsString(); contents = contents.replaceAll(RegExp(r'jwt_secret:[^\n]+\n?'), ''); - await file.writeAsString(contents.trim() + '\njwt_secret: "$secret"'); + await file.writeAsString('${contents.trim()}\njwt_secret: "$secret"'); } } } diff --git a/lib/src/commands/pub.dart b/lib/src/commands/pub.dart index d6d68d1..6900a32 100644 --- a/lib/src/commands/pub.dart +++ b/lib/src/commands/pub.dart @@ -7,7 +7,7 @@ String resolvePub() { var exec = File(Platform.resolvedExecutable); var pubPath = exec.parent.uri.resolve('pub').path; if (Platform.isWindows) { - pubPath = pubPath.replaceAll(_leadingSlashes, '') + '.bat'; + pubPath = '${pubPath.replaceAll(_leadingSlashes, '')}.bat'; } pubPath = Uri.decodeFull(pubPath); return pubPath; diff --git a/lib/src/commands/rename.dart b/lib/src/commands/rename.dart index bf229ee..84923c3 100644 --- a/lib/src/commands/rename.dart +++ b/lib/src/commands/rename.dart @@ -148,7 +148,7 @@ Future renameDartFiles(Directory dir, String oldName, String newName) async { var contents = lineList.fold('', (prev, cur) { var updatedCur = updateImport(cur, oldName, newName); updatedCur = updateMustacheBinding(updatedCur, oldName, newName); - return prev + '\n' + updatedCur; + return '$prev\n$updatedCur'; }); await file.writeAsString(fmt.format(contents)); @@ -198,7 +198,7 @@ class RenamingVisitor extends RecursiveAstVisitor { if (uri == 'package:$oldName/$oldName.dart') { return 'package:$newName/$newName.dart'; } else if (uri.startsWith('package:$oldName/')) { - return 'package:$newName/' + uri.replaceFirst('package:$oldName/', ''); + return 'package:$newName/${uri.replaceFirst('package:$oldName/', '')}'; } else { return uri; } @@ -229,7 +229,7 @@ class RenamingVisitor extends RecursiveAstVisitor { if (name.startsWith(oldName)) { replace[[node.offset, node.end]] = - 'library ' + name.replaceFirst(oldName, newName) + ';'; + 'library ${name.replaceFirst(oldName, newName)};'; } } @@ -240,7 +240,7 @@ class RenamingVisitor extends RecursiveAstVisitor { if (name.startsWith(oldName)) { replace[[node.offset, node.end]] = - 'part of ' + name.replaceFirst(oldName, newName) + ';'; + 'part of ${name.replaceFirst(oldName, newName)};'; } } } diff --git a/lib/src/commands/service_generators/custom.dart b/lib/src/commands/service_generators/custom.dart index 9008b69..3e1b62e 100644 --- a/lib/src/commands/service_generators/custom.dart +++ b/lib/src/commands/service_generators/custom.dart @@ -2,10 +2,8 @@ import 'package:code_builder/code_builder.dart'; import 'generator.dart'; class CustomServiceGenerator extends ServiceGenerator { - @override bool get createsModel => false; - @override bool get createsValidator => false; const CustomServiceGenerator() : super('Custom'); diff --git a/lib/src/commands/service_generators/generator.dart b/lib/src/commands/service_generators/generator.dart index 6328958..4eba968 100644 --- a/lib/src/commands/service_generators/generator.dart +++ b/lib/src/commands/service_generators/generator.dart @@ -8,21 +8,6 @@ class ServiceGenerator { List get dependencies => []; - @deprecated - bool get createsModel => true; - - @deprecated - bool get createsValidator => true; - - @deprecated - bool get exportedInServiceLibrary => true; - - @deprecated - bool get injectsSingleton => false; - - @deprecated - bool get shouldRunBuild => false; - bool get goesFirst => false; void applyToLibrary(LibraryBuilder library, String name, String lower) {} diff --git a/lib/src/commands/service_generators/map.dart b/lib/src/commands/service_generators/map.dart index 545961d..4004bac 100644 --- a/lib/src/commands/service_generators/map.dart +++ b/lib/src/commands/service_generators/map.dart @@ -4,7 +4,6 @@ import 'package:code_builder/code_builder.dart'; class MapServiceGenerator extends ServiceGenerator { const MapServiceGenerator() : super('In-Memory'); - @override bool get createsModel => false; @override diff --git a/lib/src/commands/service_generators/mongo.dart b/lib/src/commands/service_generators/mongo.dart index be09079..af6c39e 100644 --- a/lib/src/commands/service_generators/mongo.dart +++ b/lib/src/commands/service_generators/mongo.dart @@ -10,7 +10,6 @@ class MongoServiceGenerator extends ServiceGenerator { List get dependencies => const [MakerDependency('angel3_mongo', '^4.0.0')]; - @override bool get createsModel => false; @override diff --git a/lib/src/commands/service_generators/rethink.dart b/lib/src/commands/service_generators/rethink.dart index dcc18c8..b25bae1 100644 --- a/lib/src/commands/service_generators/rethink.dart +++ b/lib/src/commands/service_generators/rethink.dart @@ -10,7 +10,6 @@ class RethinkServiceGenerator extends ServiceGenerator { List get dependencies => const [MakerDependency('angel3_rethink', '^4.0.0')]; - @override bool get createsModel => false; @override