chore: format code and update deps

This commit is contained in:
Sergey Penkovsky
2026-01-29 16:57:28 +03:00
parent 49361f2f9e
commit 776f29945a
7 changed files with 34 additions and 40 deletions

View File

@@ -47,7 +47,7 @@ packages:
path: "../cherrypick" path: "../cherrypick"
relative: true relative: true
source: path source: path
version: "3.0.1" version: "3.0.2"
collection: collection:
dependency: transitive dependency: transitive
description: description:

View File

@@ -179,10 +179,10 @@ class InjectGenerator extends GeneratorForAnnotation<ann.injectable> {
// Determine nullability for field types like T? or Future<T?> // Determine nullability for field types like T? or Future<T?>
bool isNullable = bool isNullable =
dartType.nullabilitySuffix == NullabilitySuffix.question || dartType.nullabilitySuffix == NullabilitySuffix.question ||
(dartType is ParameterizedType && (dartType is ParameterizedType &&
(dartType).typeArguments.any( (dartType).typeArguments.any(
(t) => t.nullabilitySuffix == NullabilitySuffix.question, (t) => t.nullabilitySuffix == NullabilitySuffix.question,
)); ));
return _ParsedInjectField( return _ParsedInjectField(
fieldName: field.firstFragment.name2 ?? '', fieldName: field.firstFragment.name2 ?? '',
@@ -207,11 +207,11 @@ class InjectGenerator extends GeneratorForAnnotation<ann.injectable> {
String _generateInjectionLine(_ParsedInjectField field) { String _generateInjectionLine(_ParsedInjectField field) {
final resolveMethod = field.isFuture final resolveMethod = field.isFuture
? (field.isNullable ? (field.isNullable
? 'tryResolveAsync<${field.coreType}>' ? 'tryResolveAsync<${field.coreType}>'
: 'resolveAsync<${field.coreType}>') : 'resolveAsync<${field.coreType}>')
: (field.isNullable : (field.isNullable
? 'tryResolve<${field.coreType}>' ? 'tryResolve<${field.coreType}>'
: 'resolve<${field.coreType}>'); : 'resolve<${field.coreType}>');
final openCall = (field.scopeName != null && field.scopeName!.isNotEmpty) final openCall = (field.scopeName != null && field.scopeName!.isNotEmpty)
? "CherryPick.openScope(scopeName: '${field.scopeName}')" ? "CherryPick.openScope(scopeName: '${field.scopeName}')"

View File

@@ -305,9 +305,8 @@ class AnnotationValidator {
} }
// Check if class has public methods // Check if class has public methods
final publicMethods = classElement.methods2 final publicMethods =
.where((m) => m.isPublic) classElement.methods2.where((m) => m.isPublic).toList();
.toList();
if (publicMethods.isEmpty) { if (publicMethods.isEmpty) {
throw AnnotationValidationException( throw AnnotationValidationException(
'Module class must have at least one public method', 'Module class must have at least one public method',

View File

@@ -190,24 +190,20 @@ class BindSpec {
case BindingType.provide: case BindingType.provide:
if (isAsyncProvide) { if (isAsyncProvide) {
if (needsMultiline) { if (needsMultiline) {
final lambdaIndent = (isSingleton || named != null) final lambdaIndent =
? indent + 6 (isSingleton || named != null) ? indent + 6 : indent + 2;
: indent + 2; final closingIndent =
final closingIndent = (isSingleton || named != null) (isSingleton || named != null) ? indent + 4 : indent;
? indent + 4
: indent;
return '.toProvideAsync(\n${' ' * lambdaIndent}() => $methodName($argsStr),\n${' ' * closingIndent})'; return '.toProvideAsync(\n${' ' * lambdaIndent}() => $methodName($argsStr),\n${' ' * closingIndent})';
} else { } else {
return '.toProvideAsync(() => $methodName($argsStr))'; return '.toProvideAsync(() => $methodName($argsStr))';
} }
} else { } else {
if (needsMultiline) { if (needsMultiline) {
final lambdaIndent = (isSingleton || named != null) final lambdaIndent =
? indent + 6 (isSingleton || named != null) ? indent + 6 : indent + 2;
: indent + 2; final closingIndent =
final closingIndent = (isSingleton || named != null) (isSingleton || named != null) ? indent + 4 : indent;
? indent + 4
: indent;
return '.toProvide(\n${' ' * lambdaIndent}() => $methodName($argsStr),\n${' ' * closingIndent})'; return '.toProvide(\n${' ' * lambdaIndent}() => $methodName($argsStr),\n${' ' * closingIndent})';
} else { } else {
return '.toProvide(() => $methodName($argsStr))'; return '.toProvide(() => $methodName($argsStr))';
@@ -311,9 +307,8 @@ class BindSpec {
); );
} }
final bindingType = hasInstance final bindingType =
? BindingType.instance hasInstance ? BindingType.instance : BindingType.provide;
: BindingType.provide;
// PROHIBIT @params with @instance bindings! // PROHIBIT @params with @instance bindings!
if (bindingType == BindingType.instance && hasParams) { if (bindingType == BindingType.instance && hasParams) {

View File

@@ -53,9 +53,9 @@ class CherryPickGeneratorException extends InvalidGenerationSourceError {
this.suggestion, this.suggestion,
this.context, this.context,
}) : super( }) : super(
_formatMessage(message, category, suggestion, context, element), _formatMessage(message, category, suggestion, context, element),
element: element, element: element,
); );
static String _formatMessage( static String _formatMessage(
String message, String message,

View File

@@ -127,28 +127,28 @@ packages:
path: "../../cherrypick" path: "../../cherrypick"
relative: true relative: true
source: path source: path
version: "3.0.1" version: "3.0.2"
cherrypick_annotations: cherrypick_annotations:
dependency: "direct main" dependency: "direct main"
description: description:
path: "../../cherrypick_annotations" path: "../../cherrypick_annotations"
relative: true relative: true
source: path source: path
version: "3.0.1" version: "3.0.2-dev.0"
cherrypick_flutter: cherrypick_flutter:
dependency: "direct main" dependency: "direct main"
description: description:
path: "../../cherrypick_flutter" path: "../../cherrypick_flutter"
relative: true relative: true
source: path source: path
version: "3.0.1" version: "3.0.2"
cherrypick_generator: cherrypick_generator:
dependency: "direct dev" dependency: "direct dev"
description: description:
path: "../../cherrypick_generator" path: "../../cherrypick_generator"
relative: true relative: true
source: path source: path
version: "3.0.1" version: "3.0.2-dev.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@@ -574,4 +574,4 @@ packages:
version: "3.1.3" version: "3.1.3"
sdks: sdks:
dart: ">=3.8.0 <4.0.0" dart: ">=3.8.0 <4.0.0"
flutter: ">=3.32.0" flutter: ">=3.18.0-18.0.pre.54"

View File

@@ -175,21 +175,21 @@ packages:
path: "../../cherrypick" path: "../../cherrypick"
relative: true relative: true
source: path source: path
version: "3.0.1" version: "3.0.2"
cherrypick_annotations: cherrypick_annotations:
dependency: "direct main" dependency: "direct main"
description: description:
path: "../../cherrypick_annotations" path: "../../cherrypick_annotations"
relative: true relative: true
source: path source: path
version: "3.0.1" version: "3.0.2-dev.0"
cherrypick_generator: cherrypick_generator:
dependency: "direct dev" dependency: "direct dev"
description: description:
path: "../../cherrypick_generator" path: "../../cherrypick_generator"
relative: true relative: true
source: path source: path
version: "3.0.0" version: "3.0.2-dev.0"
cli_config: cli_config:
dependency: transitive dependency: transitive
description: description:
@@ -920,7 +920,7 @@ packages:
path: "../../talker_cherrypick_logger" path: "../../talker_cherrypick_logger"
relative: true relative: true
source: path source: path
version: "3.0.1" version: "3.0.2"
talker_dio_logger: talker_dio_logger:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -1131,4 +1131,4 @@ packages:
version: "2.2.2" version: "2.2.2"
sdks: sdks:
dart: ">=3.8.0 <4.0.0" dart: ">=3.8.0 <4.0.0"
flutter: ">=3.32.0" flutter: ">=3.29.0"