Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Update analyzer and dart_style dependencies to allow upper versions" #732

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions generator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
## 9.1.6

- Update `analyzer`, `dart_style` and `source_gen` dependencies to allow upper versions
# Changelog

## 9.1.5

Expand Down
24 changes: 8 additions & 16 deletions generator/lib/src/generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class RetrofitGenerator extends GeneratorForAnnotation<retrofit.RestApi> {
});

final emitter = DartEmitter(useNullSafetySyntax: true);
return DartFormatter(languageVersion: DartFormatter.latestLanguageVersion)
return DartFormatter()
.format([_analyzerIgnores, classBuilder.accept(emitter)].join('\n\n'));
}

Expand Down Expand Up @@ -1727,7 +1727,7 @@ if (T != dynamic &&
.assign(refer(bodyName.displayName))
.statement,
);
} else if (_missingSerialize(ele.enclosingElement3, bodyName.type)) {
} else if (_missingSerialize(ele.enclosingElement, bodyName.type)) {
log.warning(
'${_displayString(bodyName.type)} must provide a `serialize${_displayString(bodyName.type)}()` method which returns a Map.\n'
"It is programmer's responsibility to make sure the ${_displayString(bodyName.type)} is properly serialized");
Expand Down Expand Up @@ -1911,7 +1911,7 @@ ${bodyName.displayName} == null
blocks.add(returnCode);
}
if (p.type.isNullable) {
blocks.add(const Code('}'));
blocks.add(Code('}'));
}
} else if (_displayString(p.type) == 'List<int>') {
final optionalFile = m.parameters
Expand Down Expand Up @@ -2278,18 +2278,10 @@ ${bodyName.displayName} == null
}

Object? _getFieldValue(ConstantReader? value) {
if (value?.isBool ?? false) {
return value?.boolValue;
}
if (value?.isDouble ?? false) {
return value?.doubleValue;
}
if (value?.isInt ?? false) {
return value?.intValue;
}
if (value?.isString ?? false) {
return value?.stringValue;
}
if (value?.isBool ?? false) return value?.boolValue;
if (value?.isDouble ?? false) return value?.doubleValue;
if (value?.isInt ?? false) return value?.intValue;
if (value?.isString ?? false) return value?.stringValue;
if (value?.objectValue.isEnum ?? false) {
return value?.objectValue.variable?.displayName;
}
Expand All @@ -2316,7 +2308,7 @@ ${bodyName.displayName} == null
final fields = <String, Object?>{};
final type = value!.objectValue.type;
if (type is InterfaceType) {
for (final field in type.element.fields) {
for (var field in type.element.fields) {
if (!field.isStatic) {
final fieldValue = value.peek(field.name);
fields[field.name] = _getFieldValue(fieldValue);
Expand Down
12 changes: 6 additions & 6 deletions generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ topics:
- rest
- retrofit
- codegen
version: 9.1.6
version: 9.1.5
environment:
sdk: '>=3.3.0 <4.0.0'

dependencies:
analyzer: '>=6.9.0 <8.0.0'
analyzer: ^6.5.0
build: ^2.4.1
built_collection: ^5.1.1
code_builder: ^4.10.0
dart_style: '>=2.3.7 <4.0.0'
dart_style: ^2.3.0
dio: ^5.0.0
protobuf: ^3.1.0
retrofit: ^4.4.1
source_gen: '>=1.5.0 <3.0.0'
retrofit: ^4.4.0
source_gen: ^1.5.0

dev_dependencies:
lints: any
lints: ^4.0.0
source_gen_test: ^1.0.6
test: ^1.25.0
2 changes: 1 addition & 1 deletion generator/test/generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Future<void> main() async {
RetrofitGenerator(RetrofitOptions()),
defaultConfiguration: ['default'],
additionalGenerators: {
'use_result': RetrofitGenerator(RetrofitOptions(useResult: true)),
'use_result': RetrofitGenerator(RetrofitOptions(useResult: true))
},
);
}
Loading
Loading