Browse Source

refactor(dynamite): remove unnecessary toList

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/694/head
Nikolas Rimikis 1 year ago
parent
commit
4efd57b72c
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 9
      packages/dynamite/dynamite/lib/src/openapi_builder.dart

9
packages/dynamite/dynamite/lib/src/openapi_builder.dart

@ -288,7 +288,7 @@ class OpenAPIBuilder implements Builder {
), ),
); );
} }
final matchedTags = spec.tags?.where((final t) => t.name == tag).toList(); final matchedTags = spec.tags?.where((final t) => t.name == tag);
b b
..name = '$classPrefix${isRootClient ? 'Client' : _clientName(tag)}' ..name = '$classPrefix${isRootClient ? 'Client' : _clientName(tag)}'
..docs.addAll( ..docs.addAll(
@ -298,12 +298,9 @@ class OpenAPIBuilder implements Builder {
) )
..methods.addAll( ..methods.addAll(
[ [
for (final t in tags for (final t in tags.whereType<String>().where(
.whereType<String>()
.where(
(final t) => (tag != null && (t.startsWith('$tag/'))) || (tag == null && !t.contains('/')), (final t) => (tag != null && (t.startsWith('$tag/'))) || (tag == null && !t.contains('/')),
) )) ...[
.toList()) ...[
Method( Method(
(final b) => b (final b) => b
..name = _toDartName(tag == null ? t : t.substring('$tag/'.length)) ..name = _toDartName(tag == null ? t : t.substring('$tag/'.length))

Loading…
Cancel
Save