From 776f29945a870b64534e7640b970c1391aa04e28 Mon Sep 17 00:00:00 2001 From: Sergey Penkovsky Date: Thu, 29 Jan 2026 16:57:28 +0300 Subject: [PATCH] chore: format code and update deps --- benchmark_di/pubspec.lock | 2 +- .../lib/inject_generator.dart | 16 ++++++------ .../lib/src/annotation_validator.dart | 5 ++-- cherrypick_generator/lib/src/bind_spec.dart | 25 ++++++++----------- cherrypick_generator/lib/src/exceptions.dart | 6 ++--- examples/client_app/pubspec.lock | 10 ++++---- examples/postly/pubspec.lock | 10 ++++---- 7 files changed, 34 insertions(+), 40 deletions(-) diff --git a/benchmark_di/pubspec.lock b/benchmark_di/pubspec.lock index ec65489..5acb3bf 100644 --- a/benchmark_di/pubspec.lock +++ b/benchmark_di/pubspec.lock @@ -47,7 +47,7 @@ packages: path: "../cherrypick" relative: true source: path - version: "3.0.1" + version: "3.0.2" collection: dependency: transitive description: diff --git a/cherrypick_generator/lib/inject_generator.dart b/cherrypick_generator/lib/inject_generator.dart index eee034d..fe6e3a4 100644 --- a/cherrypick_generator/lib/inject_generator.dart +++ b/cherrypick_generator/lib/inject_generator.dart @@ -179,10 +179,10 @@ class InjectGenerator extends GeneratorForAnnotation { // Determine nullability for field types like T? or Future bool isNullable = dartType.nullabilitySuffix == NullabilitySuffix.question || - (dartType is ParameterizedType && - (dartType).typeArguments.any( - (t) => t.nullabilitySuffix == NullabilitySuffix.question, - )); + (dartType is ParameterizedType && + (dartType).typeArguments.any( + (t) => t.nullabilitySuffix == NullabilitySuffix.question, + )); return _ParsedInjectField( fieldName: field.firstFragment.name2 ?? '', @@ -207,11 +207,11 @@ class InjectGenerator extends GeneratorForAnnotation { String _generateInjectionLine(_ParsedInjectField field) { final resolveMethod = field.isFuture ? (field.isNullable - ? 'tryResolveAsync<${field.coreType}>' - : 'resolveAsync<${field.coreType}>') + ? 'tryResolveAsync<${field.coreType}>' + : 'resolveAsync<${field.coreType}>') : (field.isNullable - ? 'tryResolve<${field.coreType}>' - : 'resolve<${field.coreType}>'); + ? 'tryResolve<${field.coreType}>' + : 'resolve<${field.coreType}>'); final openCall = (field.scopeName != null && field.scopeName!.isNotEmpty) ? "CherryPick.openScope(scopeName: '${field.scopeName}')" diff --git a/cherrypick_generator/lib/src/annotation_validator.dart b/cherrypick_generator/lib/src/annotation_validator.dart index 6eaa52b..2472e35 100644 --- a/cherrypick_generator/lib/src/annotation_validator.dart +++ b/cherrypick_generator/lib/src/annotation_validator.dart @@ -305,9 +305,8 @@ class AnnotationValidator { } // Check if class has public methods - final publicMethods = classElement.methods2 - .where((m) => m.isPublic) - .toList(); + final publicMethods = + classElement.methods2.where((m) => m.isPublic).toList(); if (publicMethods.isEmpty) { throw AnnotationValidationException( 'Module class must have at least one public method', diff --git a/cherrypick_generator/lib/src/bind_spec.dart b/cherrypick_generator/lib/src/bind_spec.dart index 514221c..e67f198 100644 --- a/cherrypick_generator/lib/src/bind_spec.dart +++ b/cherrypick_generator/lib/src/bind_spec.dart @@ -190,24 +190,20 @@ class BindSpec { case BindingType.provide: if (isAsyncProvide) { if (needsMultiline) { - final lambdaIndent = (isSingleton || named != null) - ? indent + 6 - : indent + 2; - final closingIndent = (isSingleton || named != null) - ? indent + 4 - : indent; + final lambdaIndent = + (isSingleton || named != null) ? indent + 6 : indent + 2; + final closingIndent = + (isSingleton || named != null) ? indent + 4 : indent; return '.toProvideAsync(\n${' ' * lambdaIndent}() => $methodName($argsStr),\n${' ' * closingIndent})'; } else { return '.toProvideAsync(() => $methodName($argsStr))'; } } else { if (needsMultiline) { - final lambdaIndent = (isSingleton || named != null) - ? indent + 6 - : indent + 2; - final closingIndent = (isSingleton || named != null) - ? indent + 4 - : indent; + final lambdaIndent = + (isSingleton || named != null) ? indent + 6 : indent + 2; + final closingIndent = + (isSingleton || named != null) ? indent + 4 : indent; return '.toProvide(\n${' ' * lambdaIndent}() => $methodName($argsStr),\n${' ' * closingIndent})'; } else { return '.toProvide(() => $methodName($argsStr))'; @@ -311,9 +307,8 @@ class BindSpec { ); } - final bindingType = hasInstance - ? BindingType.instance - : BindingType.provide; + final bindingType = + hasInstance ? BindingType.instance : BindingType.provide; // PROHIBIT @params with @instance bindings! if (bindingType == BindingType.instance && hasParams) { diff --git a/cherrypick_generator/lib/src/exceptions.dart b/cherrypick_generator/lib/src/exceptions.dart index ff80fc3..8d596d5 100644 --- a/cherrypick_generator/lib/src/exceptions.dart +++ b/cherrypick_generator/lib/src/exceptions.dart @@ -53,9 +53,9 @@ class CherryPickGeneratorException extends InvalidGenerationSourceError { this.suggestion, this.context, }) : super( - _formatMessage(message, category, suggestion, context, element), - element: element, - ); + _formatMessage(message, category, suggestion, context, element), + element: element, + ); static String _formatMessage( String message, diff --git a/examples/client_app/pubspec.lock b/examples/client_app/pubspec.lock index 254945b..95f7d64 100644 --- a/examples/client_app/pubspec.lock +++ b/examples/client_app/pubspec.lock @@ -127,28 +127,28 @@ packages: path: "../../cherrypick" relative: true source: path - version: "3.0.1" + version: "3.0.2" cherrypick_annotations: dependency: "direct main" description: path: "../../cherrypick_annotations" relative: true source: path - version: "3.0.1" + version: "3.0.2-dev.0" cherrypick_flutter: dependency: "direct main" description: path: "../../cherrypick_flutter" relative: true source: path - version: "3.0.1" + version: "3.0.2" cherrypick_generator: dependency: "direct dev" description: path: "../../cherrypick_generator" relative: true source: path - version: "3.0.1" + version: "3.0.2-dev.0" clock: dependency: transitive description: @@ -574,4 +574,4 @@ packages: version: "3.1.3" sdks: dart: ">=3.8.0 <4.0.0" - flutter: ">=3.32.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/examples/postly/pubspec.lock b/examples/postly/pubspec.lock index 8c4644d..f1cdca3 100644 --- a/examples/postly/pubspec.lock +++ b/examples/postly/pubspec.lock @@ -175,21 +175,21 @@ packages: path: "../../cherrypick" relative: true source: path - version: "3.0.1" + version: "3.0.2" cherrypick_annotations: dependency: "direct main" description: path: "../../cherrypick_annotations" relative: true source: path - version: "3.0.1" + version: "3.0.2-dev.0" cherrypick_generator: dependency: "direct dev" description: path: "../../cherrypick_generator" relative: true source: path - version: "3.0.0" + version: "3.0.2-dev.0" cli_config: dependency: transitive description: @@ -920,7 +920,7 @@ packages: path: "../../talker_cherrypick_logger" relative: true source: path - version: "3.0.1" + version: "3.0.2" talker_dio_logger: dependency: "direct main" description: @@ -1131,4 +1131,4 @@ packages: version: "2.2.2" sdks: dart: ">=3.8.0 <4.0.0" - flutter: ">=3.32.0" + flutter: ">=3.29.0"