CharacterDefinition.fromJson constructor

CharacterDefinition.fromJson(
  1. Map<String, dynamic> json
)

Creates a CharacterDefinition from a JSON map.

Parameters:

  • json is a map containing key-value pairs representing the properties of a CharacterDefinition. The keys should match the property names of the CharacterDefinition class, and the values should be of the appropriate types.

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

Implementation

factory CharacterDefinition.fromJson(final Map<String, dynamic> json) {
  return CharacterDefinition(
    character: json['character'] as String,
    enclosures: json['enclosures'] as int,
    lineLeft: json['lineLeft'] as bool,
    lineRight: json['lineRight'] as bool,
    isLetter: json['isLetter'] as bool,
    isAmount: json['isAmount'] as bool,
    isDate: json['isDate'] as bool,
    isDigit: json['isDigit'] as bool,
    isPunctuation: json['isPunctuation'] as bool,
    matrices: (json['matrices'] as List)
        .map((m) => Matrix.fromJson(m as Map<String, dynamic>))
        .toList(),
  );
}