Untitled

mail@pastecode.io avatar
unknown
dart
3 years ago
2.6 kB
1
Indexable
Never

 static const String authUsername = '5m8Akhl';
  static const String authPassword = 'x6Q9k41jAx';
  static final String basicAuth =
      'Basic ' + base64Encode(utf8.encode('$authUsername:$authPassword'));

------------------------------------------------------------------------------------

class GetStateByDeviceID {
  Result result;

  GetStateByDeviceID({this.result});

  GetStateByDeviceID.fromJson(Map<String, dynamic> json) {
    result =
        json['Result'] != null ? Result.fromJson(json['Result']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    if (result != null) {
      data['Result'] = result.toJson();
    }
    return data;
  }
}

class Result {
  CustomerRequest customerRequest;
  String sId;
  String state;
  String deviceID;
  String saveTime;

  Result(
      {this.customerRequest,
      this.sId,
      this.state,
      this.deviceID,
      this.saveTime});

  Result.fromJson(Map<String, dynamic> json) {
    customerRequest = json['CustomerRequest'] != null
        ? CustomerRequest.fromJson(json['CustomerRequest'])
        : null;
    sId = json['_id'];
    state = json['State'];
    deviceID = json['DeviceID'];
    saveTime = json['SaveTime'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    if (customerRequest != null) {
      data['CustomerRequest'] = customerRequest.toJson();
    }
    data['_id'] = sId;
    data['State'] = state;
    data['DeviceID'] = deviceID;
    data['SaveTime'] = saveTime;
    return data;
  }
}

class CustomerRequest {
  double beginLat;
  double beginLng;
  double endLat;
  double endLng;
  String userID;
  String beginCity;
  String endCity;
  int routeIndex;

  CustomerRequest(
      {this.beginLat,
      this.beginLng,
      this.endLat,
      this.endLng,
      this.userID,
      this.beginCity,
      this.endCity,
      this.routeIndex});

  CustomerRequest.fromJson(Map<String, dynamic> json) {
    beginLat = json['BeginLat'];
    beginLng = json['BeginLng'];
    endLat = json['EndLat'];
    endLng = json['EndLng'];
    userID = json['UserID'];
    beginCity = json['BeginCity'];
    endCity = json['EndCity'];
    routeIndex = json['RouteIndex'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['BeginLat'] = beginLat;
    data['BeginLng'] = beginLng;
    data['EndLat'] = endLat;
    data['EndLng'] = endLng;
    data['UserID'] = userID;
    data['BeginCity'] = beginCity;
    data['EndCity'] = endCity;
    data['RouteIndex'] = routeIndex;
    return data;
  }
}