Data.fromJson constructor

Data.fromJson(
  1. String json
)

Creates a Data instance from a JSON string.

This factory constructor is used for deserializing data from JSON strings.

Parameters:

  • json: JSON string containing URL and data content

Returns:

  • New Data instance with data from the JSON

Throws:

  • FormatException if the JSON is invalid or URL is malformed

Implementation

factory Data.fromJson(String json) {
  return Data.fromMap(jsonDecode(json));
}