Template.fromJson constructor Null safety

Template.fromJson(
  1. Map<String, Object?> json
)

Named constructor to create Template from a Map.

Implementation

Template.fromJson(Map<String, Object?> json)
    : this(
        header: json['header']! as String,
        message: json['message']! as String,
        id: json['id']! as String,
        fontFamily: json['fontFamily']! as String,
        fontSize: (json['fontSize']! as num).toDouble(),
        backgrondColour: json['backgrondColour']! as int,
        foregroundColour: json['foregroundColour']! as int,
        width: (json['width']! as num).toDouble(),
        height: (json['height']! as num).toDouble(),
        textAlignment: json['textAlignment']! as String,
      );