Skip to content

Commit

Permalink
Improve naming
Browse files Browse the repository at this point in the history
  • Loading branch information
hexbabe committed Nov 19, 2024
1 parent 11fed21 commit a83aa10
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ extension StructUtils on Struct {
}
}

extension UnwrapProtoMapUtils on Map<String, dynamic> {
/// Deeply unwraps a nested proto map structure by removing unnecessary proto wrappers and
extension ProtoMapUtils on Map<String, dynamic> {
/// Deeply unwraps a map derived from a proto struct by removing unnecessary proto wrappers and
/// converting all nested values to their primitive Dart types.
///
/// Handles:
Expand Down Expand Up @@ -81,6 +81,7 @@ extension UnwrapProtoMapUtils on Map<String, dynamic> {
return [];
}

// 2a. Fields wrapper (from proto Struct)
if (kindMap.containsKey('StructValue')) {
final structValue = kindMap['StructValue'];
if (structValue is Map && structValue.containsKey('fields')) {
Expand All @@ -91,7 +92,7 @@ extension UnwrapProtoMapUtils on Map<String, dynamic> {
return value;
}

// 2. Fields wrapper (from proto Struct)
// 2b. Fields wrapper (from proto Struct)
if (mapValue.containsKey('fields')) {
return Map<String, dynamic>.from(mapValue['fields']).unwrap();
}
Expand Down

0 comments on commit a83aa10

Please sign in to comment.