castAsCollection static method

JsonCollection castAsCollection(
  1. JsonValue? value
)

Cast a JsonValue to a JsonCollection

It'll throw if value is not a JsonArray, or if array's elements are not JsonObject.

Implementation

static JsonCollection castAsCollection(JsonValue value) {
  // pass through an json array to help dart cast mechanism
  return (value as JsonArray)
      .map<JsonObject>((e) => e as JsonObject)
      .toList();
}