You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

25 lines
860 B

import 'package:hadi_hoda_flutter/features/level/data/model/level_model.dart';
import 'package:hadi_hoda_flutter/features/level/data/model/prize_model.dart';
import 'package:hadi_hoda_flutter/features/level/domain/entity/node_entity.dart';
class NodeModel extends NodeEntity {
NodeModel({super.nodeType, super.level, super.prize});
factory NodeModel.fromJson(Map<String, dynamic> json) {
return NodeModel(
nodeType: json['node_type'] == null
? null
: NodeType.fromJson[json['node_type']],
level: json['node_type'] == null
? null
: json['node_type'] == 'level'
? LevelModel.fromJson(json['data'])
: null,
prize: json['node_type'] == null
? null
: json['node_type'] == 'prize'
? PrizeModel.fromJson(json['data'])
: null,
);
}
}