Make name argument to BuilderInfo.add<T> nullable (for tree shaking purposes) (#1101)
diff --git a/protobuf/CHANGELOG.md b/protobuf/CHANGELOG.md
index 5019a98..b1b33df 100644
--- a/protobuf/CHANGELOG.md
+++ b/protobuf/CHANGELOG.md
@@ -2,6 +2,7 @@
 
 * Make `BuilderInfo` methods accept `GeneratedMessage Function()` typed
   closures.
+* Make `BuilderInfo.add` accept nullable name (for tree shaking purposes).
 
 ## 6.0.0
 
diff --git a/protobuf/lib/src/protobuf/builder_info.dart b/protobuf/lib/src/protobuf/builder_info.dart
index b98c685..7f87cb3 100644
--- a/protobuf/lib/src/protobuf/builder_info.dart
+++ b/protobuf/lib/src/protobuf/builder_info.dart
@@ -56,7 +56,7 @@
 
   void add<T>(
     int tagNumber,
-    String name,
+    String? name,
     int? fieldType,
     dynamic defaultOrMaker,
     CreateBuilderFunc? subBuilder,
@@ -69,7 +69,7 @@
     } else {
       final index = byIndex.length;
       final fieldInfo = FieldInfo<T>(
-        name,
+        name!,
         tagNumber,
         index,
         fieldType!,