ExtractLocalVariableOptions.fromJson constructor

ExtractLocalVariableOptions.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json, {
  4. ClientUriConverter? clientUriConverter,
})

Implementation

factory ExtractLocalVariableOptions.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is Map) {
    String name;
    if (json.containsKey('name')) {
      name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'name');
    }
    bool extractAll;
    if (json.containsKey('extractAll')) {
      extractAll = jsonDecoder.decodeBool(
        '$jsonPath.extractAll',
        json['extractAll'],
      );
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'extractAll');
    }
    return ExtractLocalVariableOptions(name, extractAll);
  } else {
    throw jsonDecoder.mismatch(
      jsonPath,
      'extractLocalVariable options',
      json,
    );
  }
}