fromJson static method
Returns a new Reminder instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static Reminder? 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'method'), 'Required key "Reminder[method]" is missing from JSON.');
assert(json[r'method'] != null, 'Required key "Reminder[method]" has a null value in JSON.');
assert(json.containsKey(r'minutes'), 'Required key "Reminder[minutes]" is missing from JSON.');
assert(json[r'minutes'] != null, 'Required key "Reminder[minutes]" has a null value in JSON.');
return true;
}());
return Reminder(
method: ReminderMethod.fromJson(json[r'method'])!,
minutes: mapValueOfType<int>(json, r'minutes')!,
);
}
return null;
}