TajweedRuleModel.fromJson constructor

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

Implementation

factory TajweedRuleModel.fromJson(Map<String, dynamic> json) {
  final dynamic textValue = json['text'];

  return TajweedRuleModel(
    index: json['index'] as int?,
    color: json['color'] as int,
    text: textValue is String
        ? <String, String>{
            'ar': textValue,
          }
        : Map<String, String>.from((textValue as Map?) ?? const {}),
  );
}