Skip to content

Commit

Permalink
Minor refactoring in ExtensionRegistry.getExtension (#841)
Browse files Browse the repository at this point in the history
  • Loading branch information
osa1 committed Jun 13, 2023
1 parent 0d820ef commit 831003b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions protobuf/lib/src/protobuf/extension_registry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,8 @@ class ExtensionRegistry {

/// Retrieves an extension from the registry that adds tag number [tagNumber]
/// to the [messageName] message type.
Extension? getExtension(String messageName, int tagNumber) {
final map = _extensions[messageName];
if (map != null) {
return map[tagNumber];
}
return null;
}
Extension? getExtension(String messageName, int tagNumber) =>
_extensions[messageName]?[tagNumber];

/// Creates a shallow copy of [message], with all extensions in `this` parsed
/// from the unknown fields of [message] and of every nested submessage.
Expand Down

0 comments on commit 831003b

Please sign in to comment.