fromJson static method
Converts json
to an instance of DpiResolution
.
Implementation
static DpiResolution fromJson(Map<String, dynamic> json) {
final index = (json['index']) as int?;
if (index == null) {
throw ErrorOf<DpiResolution>(
message: 'Error deserializing json to DpiResolution.',
invalidState: 'json[index] returned null.',
expectedState: 'A map entry: {index: int value}.');
}
if (index >= 0 && index < DpiResolution.values.length) {
return DpiResolution.values[index];
} else {
throw ErrorOf<DpiResolution>(
message: 'Function fromJson could not find '
'an instance of type DpiResolution.',
invalidState: 'DpiResolution.values[$index] out of bounds.');
}
}