FlutterOutlineParams.fromJson constructor

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

Implementation

factory FlutterOutlineParams.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    String file;
    if (json.containsKey('file')) {
      file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'file');
    }
    FlutterOutline outline;
    if (json.containsKey('outline')) {
      outline = FlutterOutline.fromJson(
          jsonDecoder, '$jsonPath.outline', json['outline']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'outline');
    }
    return FlutterOutlineParams(file, outline);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'flutter.outline params', json);
  }
}