Skip to content

Commit 4bd55db

Browse files
author
Johyn Papin
committed
Improved documentation of the two new methods.
Signed-off-by: Johyn Papin <[email protected]>
1 parent 531678e commit 4bd55db

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
@@ -280,7 +280,9 @@ class _FieldSet {
280280
_setNonExtensionFieldUnchecked(meta, fi, value);
281281
}
282282

283-
/// Sets a non-repeated nullable field with error-checking.
283+
/// Sets a non-repeated field with error-checking.
284+
/// This method behaves like [_setField], except if `null` is passed as
285+
/// value. In this case, [_clearField] will be called.
284286
///
285287
/// Works for both extended and non-extended fields.
286288
/// 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
@@ -403,6 +403,8 @@ abstract class GeneratedMessage {
403403
}
404404

405405
/// Sets the value of a field by its [tagNumber].
406+
/// This method should be used for optional fields when the nullable option
407+
/// is set. When `null` is passed as value, the field is cleared.
406408
///
407409
/// Throws an [ArgumentError] if [value] does not match the type associated
408410
/// with [tagNumber].

0 commit comments

Comments
 (0)