Answers for "flutter model generator"

0

flutter model generator

class Action {
  Action action;
  Device device;
  String docType;
  String id;
  String isoTimestamp;
  String mspId;
  String orgMspId;
  String transactionId;
  String userId;

  Action(
      {this.action,
      this.device,
      this.docType,
      this.id,
      this.isoTimestamp,
      this.mspId,
      this.orgMspId,
      this.transactionId,
      this.userId});

  Action.fromJson(Map<String, dynamic> json) {
    action =
        json['action'] != null ? new Action.fromJson(json['action']) : null;
    device =
        json['device'] != null ? new Device.fromJson(json['device']) : null;
    docType = json['doc_type'];
    id = json['id'];
    isoTimestamp = json['iso_timestamp'];
    mspId = json['msp_id'];
    orgMspId = json['org_msp_id'];
    transactionId = json['transaction_id'];
    userId = json['user_id'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.action != null) {
      data['action'] = this.action.toJson();
    }
    if (this.device != null) {
      data['device'] = this.device.toJson();
    }
    data['doc_type'] = this.docType;
    data['id'] = this.id;
    data['iso_timestamp'] = this.isoTimestamp;
    data['msp_id'] = this.mspId;
    data['org_msp_id'] = this.orgMspId;
    data['transaction_id'] = this.transactionId;
    data['user_id'] = this.userId;
    return data;
  }
}

class Action {
  Action action;
  String comment;
  Action section;
  String timeStamp;

  Action({this.action, this.comment, this.section, this.timeStamp});

  Action.fromJson(Map<String, dynamic> json) {
    action =
        json['action'] != null ? new Action.fromJson(json['action']) : null;
    comment = json['comment'];
    section =
        json['section'] != null ? new Action.fromJson(json['section']) : null;
    timeStamp = json['time_stamp'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.action != null) {
      data['action'] = this.action.toJson();
    }
    data['comment'] = this.comment;
    if (this.section != null) {
      data['section'] = this.section.toJson();
    }
    data['time_stamp'] = this.timeStamp;
    return data;
  }
}

class Action {
  String id;
  String name;

  Action({this.id, this.name});

  Action.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    return data;
  }
}

class Device {
  String battery;
  String deviceId;
  String deviceVersion;
  String firmwareVersion;
  Gps gps;
  String id;
  String signal;
  String simCardNumber;
  String timeStamp;

  Device(
      {this.battery,
      this.deviceId,
      this.deviceVersion,
      this.firmwareVersion,
      this.gps,
      this.id,
      this.signal,
      this.simCardNumber,
      this.timeStamp});

  Device.fromJson(Map<String, dynamic> json) {
    battery = json['battery'];
    deviceId = json['device_id'];
    deviceVersion = json['device_version'];
    firmwareVersion = json['firmware_version'];
    gps = json['gps'] != null ? new Gps.fromJson(json['gps']) : null;
    id = json['id'];
    signal = json['signal'];
    simCardNumber = json['sim_card_number'];
    timeStamp = json['time_stamp'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['battery'] = this.battery;
    data['device_id'] = this.deviceId;
    data['device_version'] = this.deviceVersion;
    data['firmware_version'] = this.firmwareVersion;
    if (this.gps != null) {
      data['gps'] = this.gps.toJson();
    }
    data['id'] = this.id;
    data['signal'] = this.signal;
    data['sim_card_number'] = this.simCardNumber;
    data['time_stamp'] = this.timeStamp;
    return data;
  }
}

class Gps {
  String accuracy;
  String latitude;
  String longitude;
  String speed;
  String type;

  Gps({this.accuracy, this.latitude, this.longitude, this.speed, this.type});

  Gps.fromJson(Map<String, dynamic> json) {
    accuracy = json['accuracy'];
    latitude = json['latitude'];
    longitude = json['longitude'];
    speed = json['speed'];
    type = json['type'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['accuracy'] = this.accuracy;
    data['latitude'] = this.latitude;
    data['longitude'] = this.longitude;
    data['speed'] = this.speed;
    data['type'] = this.type;
    return data;
  }
}
Posted by: Guest on July-01-2021

Code answers related to "flutter model generator"

Browse Popular Code Answers by Language