CharacterDefinition.fromJsonString constructor

CharacterDefinition.fromJsonString(
  1. String jsonString
)

Creates a CharacterDefinition from a JSON string.

jsonString is a String containing a JSON representation of a CharacterDefinition. The JSON structure should match the properties of the CharacterDefinition class.

This factory method first decodes the JSON string into a Map using jsonDecode, then delegates to CharacterDefinition.fromJson to create the instance.

Returns a new instance of CharacterDefinition populated with the data from jsonString.

Throws a FormatException if the string is not valid JSON. Throws a TypeError if the JSON structure doesn't match the expected format.

Implementation

factory CharacterDefinition.fromJsonString(final String jsonString) {
  return CharacterDefinition.fromJson(
    jsonDecode(jsonString) as Map<String, dynamic>,
  );
}