fromJson static method
Returns a new Industries instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static Industries? fromJson(dynamic value) {
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'industry_name'), 'Required key "Industries[industry_name]" is missing from JSON.');
assert(json[r'industry_name'] != null, 'Required key "Industries[industry_name]" has a null value in JSON.');
assert(json.containsKey(r'short_name'), 'Required key "Industries[short_name]" is missing from JSON.');
assert(json[r'short_name'] != null, 'Required key "Industries[short_name]" has a null value in JSON.');
return true;
}());
return Industries(
dateCreated: mapDateTime(json, r'date_created', r''),
lastUpdated: mapDateTime(json, r'last_updated', r''),
industryId: mapValueOfType<int>(json, r'industry_id'),
industryName: mapValueOfType<String>(json, r'industry_name')!,
shortName: mapValueOfType<String>(json, r'short_name')!,
slug: mapValueOfType<String>(json, r'slug'),
naiscCode: mapValueOfType<int>(json, r'naisc_code'),
description: mapValueOfType<String>(json, r'description'),
);
}
return null;
}