ContentsExample.fromJson constructor

ContentsExample.fromJson(
  1. Object? j
)

Implementation

factory ContentsExample.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return ContentsExample(
    contents: switch (json['contents']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Content.fromJson(i)],
      _ => throw const FormatException('"contents" is not a list'),
    },
    expectedContents: switch (json['expectedContents']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) ContentsExample_ExpectedContent.fromJson(i),
      ],
      _ => throw const FormatException('"expectedContents" is not a list'),
    },
  );
}