free_meal_config_model.dart 2.11 KB
import 'package:one_key/models/recharge_list_model.dart';

import 'dart:convert' as convert;

class FreeMealConfigModel {
  int? ret;
  List<FreeMealConfigSunModel>? data;
  String? msg;

  FreeMealConfigModel({this.ret, this.data, this.msg});

  FreeMealConfigModel.fromJson(Map<dynamic, dynamic> json) {
    ret = json['ret'];
    if (json['data'] != null) {
      data = <FreeMealConfigSunModel>[];
      json['data'].forEach((v) {
        data!.add(new FreeMealConfigSunModel.fromJson(v));
      });
    }
    msg = json['msg'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['ret'] = this.ret;
    if (this.data != null) {
      data['data'] = this.data!.map((v) => v.toJson()).toList();
    }
    data['msg'] = this.msg;
    return data;
  }
}

class FreeMealConfigSunModel {
  String? id;
  String? sellerid;
  String? uid;
  String? type;
  String? multiple;
  RechargeListDataModel? rechargeList;
  String? explain;
  String? isOpen;

  FreeMealConfigSunModel(
      {this.id,
      this.sellerid,
      this.uid,
      this.type,
      this.multiple,
      this.rechargeList,
      this.explain,
      this.isOpen});

  FreeMealConfigSunModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    sellerid = json['sellerid'];
    uid = json['uid'];
    type = json['type'];
    multiple = json['multiple'];

    rechargeList = json['recharge_list'] == null
        ? null
        : json['recharge_list'] is Map
            ? RechargeListDataModel.fromJson(json['recharge_list'])
            : RechargeListDataModel.fromJson(convert
                .jsonDecode(json['recharge_list']) as Map<String, dynamic>);

    explain = json['explain'];
    isOpen = json['is_open'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['sellerid'] = this.sellerid;
    data['uid'] = this.uid;
    data['type'] = this.type;
    data['multiple'] = this.multiple;
    data['recharge_list'] = this.rechargeList;
    data['explain'] = this.explain;
    data['is_open'] = this.isOpen;
    return data;
  }
}