Skip to content

Upgrading protobuf 3 to 4

Breaking3.1.0 → 4.2.0Breaking4Platform3Changed5Other1

BreakingUpgrade verdict

4 breaking changes and 3 platform requirement changes.

  • Some internal event-related classes and helper methods are gone, so code that used them will no longer compile.
  • Two JSON helper methods on BuilderInfo are gone, so code calling them will no longer compile.
  • Code that passes other TypedData values to writeRawBytes must now pass a Uint8List.
  • Creating an unmodifiable map now requires passing the key and value types rather than an existing map.
Top 5 of 7 that need code or config changes

Dart SDK requirement changed in 4.1.1: >=2.19.0 <4.0.0 → ^3.7.0.

Breaking4
Removes PbEventMixin, PbFieldChange, EventBuffer, GeneratedMessage.createRepeatedField and GeneratedMessage.createMapField.
PbEventMixinPbFieldChangeEventBufferGeneratedMessage.createRepeatedFieldGeneratedMessage.createMapField
Removes BuilderInfo.fromProto3Json and BuilderInfo.toProto3Json as part of an internal refactoring.
BuilderInfo.fromProto3JsonBuilderInfo.toProto3Json
CodedBufferWriter.writeRawBytes now takes a Uint8List argument instead of TypedData.
CodedBufferWriter.writeRawBytesUint8ListTypedData
PbMap.unmodifiable now takes key and value field types as arguments instead of another PbMap.
PbMap.unmodifiablePbMap
Platform3
Raises the minimum Dart SDK dependency from 3.6.0 to 3.7.0.
Bumps the minimum Dart SDK dependency from 3.3.0 to 3.6.0.
Minimum SDK dependency bumped from 2.19.0 to 3.3.0.