Skip to content

High performance self-hosted photo and video management solution.

1.0 KB
Raw Blame
--- native_class.mustache	2026-06-03 12:23:39
+++ native_class.mustache	2026-06-03 12:21:49
@@ -154,24 +154,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(() {
-  {{#vars}}
-    {{#required}}
-        assert(json.containsKey(r'{{{baseName}}}'), 'Required key "{{{classname}}}[{{{baseName}}}]" is missing from JSON.');
-      {{^isNullable}}
-        assert(json[r'{{{baseName}}}'] != null, 'Required key "{{{classname}}}[{{{baseName}}}]" has a null value in JSON.');
-      {{/isNullable}}
-    {{/required}}
-  {{/vars}}
-        return true;
-      }());
-
       return {{{classname}}}(
   {{#vars}}
     {{#isDateTime}}