Link<StoryContent>.fromJson constructor

Link<StoryContent>.fromJson(
  1. JSONMap json
)

Implementation

factory Link.fromJson(JSONMap json) {
  final type = json["linktype"];
  return switch (type) {
    "url" => LinkURL.fromJson(json),
    "asset" => LinkAsset.fromJson(json),
    "email" => LinkEmail.fromJson(json),
    "story" => LinkStory.fromJson(json),
    _ => throw "Unrecognized linktype: $type",
  };
}