-
Couldn't load subscription status.
- Fork 195
Closed
Description
Moving this TODO from #959.
I think "check" functions in PbLists can be completely eliminated for the scalars where we only check for nulls:
protobuf.dart/protobuf/lib/src/protobuf/field_error.dart
Lines 75 to 107 in d00f905
| CheckFunc getCheckFunction(int fieldType) { | |
| switch (fieldType & ~0x7) { | |
| case PbFieldType._BOOL_BIT: | |
| case PbFieldType._BYTES_BIT: | |
| case PbFieldType._STRING_BIT: | |
| case PbFieldType._DOUBLE_BIT: | |
| case PbFieldType._ENUM_BIT: | |
| case PbFieldType._GROUP_BIT: | |
| case PbFieldType._MESSAGE_BIT: | |
| case PbFieldType._INT64_BIT: | |
| case PbFieldType._SINT64_BIT: | |
| case PbFieldType._SFIXED64_BIT: | |
| case PbFieldType._UINT64_BIT: | |
| case PbFieldType._FIXED64_BIT: | |
| // We always use the full range of the same Dart type. | |
| // It's up to the caller to treat the Int64 as signed or unsigned. | |
| // See: https://github.com/google/protobuf.dart/issues/44 | |
| return _checkNotNull; | |
| case PbFieldType._FLOAT_BIT: | |
| return _checkFloat; | |
| case PbFieldType._INT32_BIT: | |
| case PbFieldType._SINT32_BIT: | |
| case PbFieldType._SFIXED32_BIT: | |
| return _checkSigned32; | |
| case PbFieldType._UINT32_BIT: | |
| case PbFieldType._FIXED32_BIT: | |
| return _checkUnsigned32; | |
| } | |
| throw ArgumentError('check function not implemented: $fieldType'); | |
| } |
The generated API for these have non-nullable element type (e.g. PbList<int>) so null checks no longer do anything (since null safety).
Metadata
Metadata
Assignees
Labels
No labels