gen client

This commit is contained in:
timonrieger
2026-05-04 17:22:50 +02:00
parent 17af4324eb
commit 49b30ea2f2
315 changed files with 4724 additions and 930 deletions
+19 -3
View File
@@ -78,15 +78,31 @@ class OcrConfig {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static OcrConfig? fromJson(dynamic value) {
upgradeDto(value, "OcrConfig");
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(() {
assert(json.containsKey(r'enabled'), 'Required key "OcrConfig[enabled]" is missing from JSON.');
assert(json[r'enabled'] != null, 'Required key "OcrConfig[enabled]" has a null value in JSON.');
assert(json.containsKey(r'maxResolution'), 'Required key "OcrConfig[maxResolution]" is missing from JSON.');
assert(json[r'maxResolution'] != null, 'Required key "OcrConfig[maxResolution]" has a null value in JSON.');
assert(json.containsKey(r'minDetectionScore'), 'Required key "OcrConfig[minDetectionScore]" is missing from JSON.');
assert(json[r'minDetectionScore'] != null, 'Required key "OcrConfig[minDetectionScore]" has a null value in JSON.');
assert(json.containsKey(r'minRecognitionScore'), 'Required key "OcrConfig[minRecognitionScore]" is missing from JSON.');
assert(json[r'minRecognitionScore'] != null, 'Required key "OcrConfig[minRecognitionScore]" has a null value in JSON.');
assert(json.containsKey(r'modelName'), 'Required key "OcrConfig[modelName]" is missing from JSON.');
assert(json[r'modelName'] != null, 'Required key "OcrConfig[modelName]" has a null value in JSON.');
return true;
}());
return OcrConfig(
enabled: mapValueOfType<bool>(json, r'enabled')!,
maxResolution: mapValueOfType<int>(json, r'maxResolution')!,
minDetectionScore: (mapValueOfType<num>(json, r'minDetectionScore')!).toDouble(),
minRecognitionScore: (mapValueOfType<num>(json, r'minRecognitionScore')!).toDouble(),
minDetectionScore: mapValueOfType<double>(json, r'minDetectionScore')!,
minRecognitionScore: mapValueOfType<double>(json, r'minRecognitionScore')!,
modelName: mapValueOfType<String>(json, r'modelName')!,
);
}