deserialize method Null safety

ByValueKey deserialize(
  1. Map<String, String> json
)

Deserializes the finder from JSON generated by serialize.

Implementation

static ByValueKey deserialize(Map<String, String> json) {
  final String keyValueString = json['keyValueString']!;
  final String keyValueType = json['keyValueType']!;
  switch (keyValueType) {
    case 'int':
      return ByValueKey(int.parse(keyValueString));
    case 'String':
      return ByValueKey(keyValueString);
    default:
      throw _createInvalidKeyValueTypeError(keyValueType);
  }
}