Skip to content

Commit

Permalink
Fix bug in JSON type cast (#19)
Browse files Browse the repository at this point in the history
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
  • Loading branch information
vominhmanh and glenn-jocher authored May 13, 2024
1 parent eb82bfe commit 964cf01
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/ultralytics_yolo_platform_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ class PlatformChannelUltralyticsYolo implements UltralyticsYoloPlatform {
result = result as List;

for (dynamic json in result) {
json = json as Map<String, dynamic>;
objects.add(ClassificationResult.fromJson(json));
objects.add(ClassificationResult.fromJson(Map<String, dynamic>.from (json as Map)));
}

return objects;
Expand Down Expand Up @@ -132,9 +131,7 @@ class PlatformChannelUltralyticsYolo implements UltralyticsYoloPlatform {
final objects = <ClassificationResult>[];

result?.forEach((json) {
json = json as Map<String, dynamic>?;
if (json == null) return;
objects.add(ClassificationResult.fromJson(json));
objects.add(ClassificationResult.fromJson(Map<String, dynamic>.from (json as Map)));
});

return objects;
Expand Down

0 comments on commit 964cf01

Please sign in to comment.