Index: lib/src/protobuf/field_info.dart |
diff --git a/lib/src/protobuf/field_info.dart b/lib/src/protobuf/field_info.dart |
index d46f1a48a1cd9453debac8a3d8c84b1491ee7188..a26c1ee2d9421942c45e63c36129ad51d183e86d 100644 |
--- a/lib/src/protobuf/field_info.dart |
+++ b/lib/src/protobuf/field_info.dart |
@@ -16,12 +16,17 @@ class FieldInfo { |
final ValueOfFunc valueOf; |
FieldInfo(this.name, this.tagNumber, int type, |
- [MakeDefaultFunc makeDefault, |
+ [dynamic defaultOrMaker, |
this.subBuilder, |
this.valueOf]) |
: this.type = type, |
- this.makeDefault = makeDefault == null ? |
- GeneratedMessage._defaultForType(type) : makeDefault; |
+ this.makeDefault = findMakeDefault(type, defaultOrMaker); |
+ |
+ static MakeDefaultFunc findMakeDefault(int type, dynamic defaultOrMaker) { |
+ if (defaultOrMaker == null) return GeneratedMessage._defaultForType(type); |
+ if (defaultOrMaker is MakeDefaultFunc) return defaultOrMaker; |
+ return () => defaultOrMaker; |
+ } |
String toString() => name; |
} |