fromJson static method
Returns a new AccountUsage instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static AccountUsage? 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'date'), 'Required key "AccountUsage[date]" is missing from JSON.');
assert(json[r'date'] != null, 'Required key "AccountUsage[date]" has a null value in JSON.');
return true;
}());
return AccountUsage(
date: mapValueOfType<String>(json, r'date')!,
apiCalls: mapValueOfType<int>(json, r'api_calls'),
emailSends: mapValueOfType<int>(json, r'email_sends'),
notesCount: mapValueOfType<int>(json, r'notes_count'),
sheetsCount: mapValueOfType<int>(json, r'sheets_count'),
slidesCount: mapValueOfType<int>(json, r'slides_count'),
filesCount: mapValueOfType<int>(json, r'files_count'),
tasksCount: mapValueOfType<int>(json, r'tasks_count'),
);
}
return null;
}