--- native_class.mustache	2025-07-01 08:29:23.968133163 +0800
+++ native_class_temp.mustache	2025-07-01 08:29:44.225850583 +0800
@@ -91,14 +91,14 @@
     {{/isDateTime}}
     {{#isNullable}}
     } else {
-      json[r'{{{baseName}}}'] = null;
+    //  json[r'{{{baseName}}}'] = null;
     }
     {{/isNullable}}
     {{^isNullable}}
       {{^required}}
         {{^defaultValue}}
     } else {
-      json[r'{{{baseName}}}'] = null;
+    //  json[r'{{{baseName}}}'] = null;
     }
         {{/defaultValue}}
       {{/required}}
@@ -111,20 +111,10 @@
   /// [value] if it's a [Map], null otherwise.
   // ignore: prefer_constructors_over_static_methods
   static {{{classname}}}? fromJson(dynamic value) {
+    upgradeDto(value, "{{{classname}}}");
     if (value is Map) {
       final json = value.cast<String, dynamic>();

-      // Ensure that the map contains the required keys.
-      // Note 1: the values aren't checked for validity beyond being non-null.
-      // Note 2: this code is stripped in release mode!
-      assert(() {
-        requiredKeys.forEach((key) {
-          assert(json.containsKey(key), 'Required key "{{{classname}}}[$key]" is missing from JSON.');
-          assert(json[key] != null, 'Required key "{{{classname}}}[$key]" has a null value in JSON.');
-        });
-        return true;
-      }());
-
       return {{{classname}}}(
   {{#vars}}
     {{#isDateTime}}
@@ -215,6 +205,10 @@
             ? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}
             : {{/isNullable}}{{{datatypeWithEnum}}}.parse('${json[r'{{{baseName}}}']}'),
               {{/isNumber}}
+              {{#isDouble}}
+        {{{name}}}: (mapValueOfType<num>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}){{#isNullable}}?{{/isNullable}}.toDouble(),
+              {{/isDouble}}
+              {{^isDouble}}
               {{^isNumber}}
                 {{^isEnum}}
         {{{name}}}: mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
@@ -223,6 +217,7 @@
         {{{name}}}: {{{enumName}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
                 {{/isEnum}}
               {{/isNumber}}
+              {{/isDouble}}
             {{/isMap}}
           {{/isArray}}
         {{/complexType}}
