Skip to content

Commit e6d2114

Browse files
committed
style: reemplazar forEach con for loop para resource cleanup
1 parent 3867a90 commit e6d2114

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/src/on_device_embeddings_adapter.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,14 @@ class OnDeviceEmbeddingsAdapter implements EmbeddingsAdapter {
162162
'Unexpected output shape from ONNX model. Expected dimension $_dimension or sequence length * $_dimension.');
163163
} finally {
164164
// Ensure native resources are released even if an exception occurs
165-
inputs.forEach((k, v) => v.release());
165+
for (final entry in inputs.entries) {
166+
entry.value.release();
167+
}
166168
runOptions.release();
167169
if (outputs != null) {
168-
outputs.forEach((v) => v?.release());
170+
for (final v in outputs) {
171+
v?.release();
172+
}
169173
}
170174
}
171175
}

0 commit comments

Comments
 (0)