fromJsonArray static method
List<Contributor>
fromJsonArray(
- dynamic json, {
- LinkHrefNormalizer normalizeHref = linkHrefNormalizerIdentity,
Creates a list of Contributor from its RWPM JSON representation.
The links' href and their children's will be normalized recursively using the
provided normalizeHref
closure.
If a contributor can't be parsed, a warning will be logged with warnings
.
Implementation
static List<Contributor> fromJsonArray(dynamic json,
{LinkHrefNormalizer normalizeHref = linkHrefNormalizerIdentity}) {
if (json is String || json is Map<String, dynamic>) {
return [json]
.map((it) => Contributor.fromJson(it, normalizeHref: normalizeHref))
.whereNotNull()
.toList();
} else if (json is List) {
return json
.map((it) => Contributor.fromJson(it, normalizeHref: normalizeHref))
.whereNotNull()
.toList();
}
return [];
}