From: Woody Guo Date: Tue, 12 Jun 2018 18:35:40 +0000 (+0800) Subject: Dart: Generate the enum from 0 if value is null and fix inconsistent naming when... X-Git-Tag: v1.10.0~103 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5a3f18d17d09ced147a78f4cb8be8ca49b403ea8;p=platform%2Fupstream%2Fflatbuffers.git Dart: Generate the enum from 0 if value is null and fix inconsistent naming when generating object builder (#4782) * Dart: Generate the enum from 0 if value is null * Dart: Fix inconsistent naming when generating object builder --- diff --git a/src/idl_gen_dart.cpp b/src/idl_gen_dart.cpp index 41343d7..3f2555d 100644 --- a/src/idl_gen_dart.cpp +++ b/src/idl_gen_dart.cpp @@ -210,7 +210,7 @@ class DartGenerator : public BaseGenerator { code += " final int value;\n"; code += " const " + name + "._(this.value);\n\n"; code += " factory " + name + ".fromValue(int value) {\n"; - code += " if (value == null) return null;\n"; + code += " if (value == null) value = 0;\n"; code += " if (!values.containsKey(value)) {\n"; code += @@ -769,7 +769,7 @@ class DartGenerator : public BaseGenerator { } code += "\n : null;\n"; } else if (field.value.type.base_type == BASE_TYPE_STRING) { - code += " = fbBuilder.writeString(_" + field.name + ");\n"; + code += " = fbBuilder.writeString(_" + MakeCamel(field.name, false) + ");\n"; } else { code += " = _" + MakeCamel(field.name, false) + "?.getOrCreateOffset(fbBuilder);\n";