PluginVersionCheckParams.fromJson constructor

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

Implementation

factory PluginVersionCheckParams.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    String byteStorePath;
    if (json.containsKey('byteStorePath')) {
      byteStorePath = jsonDecoder.decodeString(
          '$jsonPath.byteStorePath', json['byteStorePath']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'byteStorePath');
    }
    String sdkPath;
    if (json.containsKey('sdkPath')) {
      sdkPath =
          jsonDecoder.decodeString('$jsonPath.sdkPath', json['sdkPath']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'sdkPath');
    }
    String version;
    if (json.containsKey('version')) {
      version =
          jsonDecoder.decodeString('$jsonPath.version', json['version']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'version');
    }
    return PluginVersionCheckParams(byteStorePath, sdkPath, version);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'plugin.versionCheck params', json);
  }
}