RenameOptions.fromJson constructor

RenameOptions.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json
)

Implementation

factory RenameOptions.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    String newName;
    if (json.containsKey('newName')) {
      newName =
          jsonDecoder.decodeString('$jsonPath.newName', json['newName']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'newName');
    }
    return RenameOptions(newName);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'rename options', json);
  }
}