Message.fromJson constructor Null safety

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

Named constructor to create Message from a Map.

Implementation

Message.fromJson(Map<String, Object?> json)
    : this(
        header: json['header']! as String,
        message: json['message']! as String,
        x: (json['x']! as num).toDouble(),
        y: (json['y']! as num).toDouble(),
        id: json['id']! as String,
        from: DateTime.parse((json['from']! as Timestamp).toDate().toString()),
        to: DateTime.parse((json['to']! as Timestamp).toDate().toString()),
        scheduled: (json['scheduled'])! as bool,
        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,
      );