import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart'; import 'package:aku_community_manager/models/todo_bussiness/todo_outdoor_model.dart'; class ToDoModel { dynamic dynamicModel; int type; ToDoModel({this.dynamicModel, this.type}); ToDoModel.fromJson(Map json) { type = json['type']; switch (type) { case 1: dynamicModel = json['dataList'] != null ? new BussinessAndFixModel.fromJson(json['dataList']) : null; break; case 2: dynamicModel = json['dataList'] != null ? new ToDoOutDoorModel.fromJson(json['dataList']) : null; break; default: dynamicModel = json['dataList'] != null ? [] : null; } } Map toJson() { final Map data = new Map(); if (this.dynamicModel != null) { data['dataList'] = this.dynamicModel.toJson(); } data['type'] = this.type; return data; } }