Skip to content

Commit f6eb0d6

Browse files
committed
Improved documentation of the two new methods.
Signed-off-by: Chito <[email protected]>
1 parent aa2c83a commit f6eb0d6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

protobuf/lib/src/protobuf/field_set.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,9 @@ class _FieldSet {
279279
_setNonExtensionFieldUnchecked(meta, fi, value);
280280
}
281281

282-
/// Sets a non-repeated nullable field with error-checking.
282+
/// Sets a non-repeated field with error-checking.
283+
/// This method behaves like [_setField], except if `null` is passed as
284+
/// value. In this case, [_clearField] will be called.
283285
///
284286
/// Works for both extended and non-extended fields.
285287
/// Suitable for public API.

protobuf/lib/src/protobuf/generated_message.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ abstract class GeneratedMessage {
418418
}
419419

420420
/// Sets the value of a field by its [tagNumber].
421+
/// This method should be used for optional fields when the nullable option
422+
/// is set. When `null` is passed as value, the field is cleared.
421423
///
422424
/// Throws an [ArgumentError] if [value] does not match the type associated
423425
/// with [tagNumber].

0 commit comments

Comments
 (0)