From 4efd57b72c6d131ab8ce5f5dff8e055d099f2ade Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Sat, 2 Sep 2023 20:32:45 +0200 Subject: [PATCH] refactor(dynamite): remove unnecessary toList Signed-off-by: Nikolas Rimikis --- packages/dynamite/dynamite/lib/src/openapi_builder.dart | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/dynamite/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/dynamite/lib/src/openapi_builder.dart index 984a742a..2630ccdb 100644 --- a/packages/dynamite/dynamite/lib/src/openapi_builder.dart +++ b/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 ..name = '$classPrefix${isRootClient ? 'Client' : _clientName(tag)}' ..docs.addAll( @@ -298,12 +298,9 @@ class OpenAPIBuilder implements Builder { ) ..methods.addAll( [ - for (final t in tags - .whereType() - .where( + for (final t in tags.whereType().where( (final t) => (tag != null && (t.startsWith('$tag/'))) || (tag == null && !t.contains('/')), - ) - .toList()) ...[ + )) ...[ Method( (final b) => b ..name = _toDartName(tag == null ? t : t.substring('$tag/'.length))