我试图解决它。但是我遇到这个问题特别针对特定用户。某些用户的数据正确显示,但某些数据给出此错误。我不明白问题出在哪里。
这是屏幕代码
FutureBuilder(
future: user.fetchData(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return quickInfo(snapshot.data);
} else if (snapshot.hasError) {
print(snapshot.error);
return Text("Something Error. Try again later");
}
return Container(
height: 50,
alignment: Alignment.center,
child: Text("Loading..."),
);
},
),
quickInfo方法代码
Widget quickInfo(User user) {
var todayVisits = visitByDay(user);
var monthlyVisits = visitByMonth(user);
return Container(
child: Column(
children: <Widget>[
SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Column(
children: <Widget>[
Text(
todayVisits.toString() ?? '0',
style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold),
),
Text("Today Visits"),
],
),
Column(
children: <Widget>[
Text(
monthlyVisits.toString() ?? '0',
style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold),
),
Text("Monthly Visits"),
],
),
Column(
children: <Widget>[
Text(
user.clients.length.toString() ?? '0',
style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold),
),
Text("Total Clients"),
],
),
],
),
Divider(
height: 30,
thickness: 2.0,
),
],
),
);
}
Rest API数据样本
{
"id": 1,
"name": "Shibaji Debnath",
"mobile": "8981009499",
"sms_token": null,
"mobile_verified_at": null,
"email": "shibaji@gmail.com",
"email_token": null,
"email_verified_at": null,
"password": "$2y$10$HVZGCGnmLdluKx.nBBUKseP.3SYwb/t8.9C4aoH9ckibJRSjWr23W",
"remember_token": null,
"avatar": null,
"address": "Dum Dum",
"city": "Kolkata",
"state": "West Bengal",
"country": "India",
"pincode": 700074,
"location_id": 1,
"travelled": "Dum Dum",
"adharcard": "345678",
"pancard": "345678",
"specialisation": "0",
"services": null,
"min_charge": "500",
"max_charge": "1000",
"online_charge": null,
"qualification": "MCOM",
"experience": "All",
"language": null,
"active": "0",
"varify": "1",
"payment_mode": null,
"created_at": "2020-08-11T08:21:31.000000Z",
"updated_at": "2020-08-27T16:13:58.000000Z",
"rating": "2.7",
"clients": [
{
"id": 40,
"client_id": 1,
"perpose": "Astrology",
"details": "Know my Future",
"when": "2020-08-22 16:00",
"accepted_by": 1,
"name": "Shibaji Debnath",
"mobile": "8981009499",
"email": "imshibaji@gmail.com",
"org_name": "Personal",
"address": "12/2 Kobi Madam Mitra Lane",
"city": "Kolkata",
"state": "West Bengal",
"pincode": "700087",
"country": "India",
"latitude": null,
"longitude": null,
"client_ip": null,
"device": null,
"created_at": "2020-08-19T08:30:05.000000Z",
"updated_at": "2020-09-01T19:13:36.000000Z"
},
{
"id": 47,
"client_id": 30,
"perpose": "Pooja",
"details": "Laxmi Narayana Puja",
"when": "2020-08-29 14:00",
"accepted_by": 1,
"name": "Bimal Roy",
"mobile": "6458998590",
"email": "bimal@abc.com",
"org_name": "My House",
"address": "Kumarpara, Dum Dum Cant. Gorabazar.",
"city": "Kolkata",
"state": "West Bengal",
"pincode": "700028",
"country": "India",
"latitude": null,
"longitude": null,
"client_ip": null,
"device": null,
"created_at": "2020-08-26T08:17:47.000000Z",
"updated_at": "2020-09-01T19:13:25.000000Z"
},
{
"id": 48,
"client_id": 31,
"perpose": "Nadi",
"details": "Nahhii hhj",
"when": "2020-09-02 20:01",
"accepted_by": 1,
"name": "Shyam Ghose",
"mobile": "6787998780",
"email": "shyam@abc.com",
"org_name": "House Party",
"address": "Desmukh Part",
"city": "Kolkata",
"state": "West Bengal",
"pincode": "700089",
"country": "India",
"latitude": null,
"longitude": null,
"client_ip": null,
"device": null,
"created_at": "2020-08-26T15:06:43.000000Z",
"updated_at": "2020-09-01T19:13:22.000000Z"
}
],
"visits": [
{
"id": 1,
"pandit_activity_id": 7,
"pandit_id": 1,
"checkIn": "2020-08-24 02:10:18",
"checkOut": null,
"created_at": "2020-08-23T20:40:18.000000Z",
"updated_at": "2020-08-23T20:40:18.000000Z"
},
{
"id": 2,
"pandit_activity_id": 7,
"pandit_id": 1,
"checkIn": "2020-08-24 02:12:40",
"checkOut": null,
"created_at": "2020-08-23T20:42:40.000000Z",
"updated_at": "2020-08-23T20:42:40.000000Z"
},
{
"id": 3,
"pandit_activity_id": 7,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-24 02:12:58",
"created_at": "2020-08-23T20:42:58.000000Z",
"updated_at": "2020-08-23T20:42:58.000000Z"
},
{
"id": 4,
"pandit_activity_id": 2,
"pandit_id": 1,
"checkIn": "2020-08-24 02:21:56",
"checkOut": null,
"created_at": "2020-08-23T20:51:56.000000Z",
"updated_at": "2020-08-23T20:51:56.000000Z"
},
{
"id": 5,
"pandit_activity_id": 2,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-24 02:22:00",
"created_at": "2020-08-23T20:52:00.000000Z",
"updated_at": "2020-08-23T20:52:00.000000Z"
},
{
"id": 6,
"pandit_activity_id": 5,
"pandit_id": 1,
"checkIn": "2020-08-24 02:22:27",
"checkOut": null,
"created_at": "2020-08-23T20:52:27.000000Z",
"updated_at": "2020-08-23T20:52:27.000000Z"
},
{
"id": 7,
"pandit_activity_id": 5,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-24 02:22:30",
"created_at": "2020-08-23T20:52:30.000000Z",
"updated_at": "2020-08-23T20:52:30.000000Z"
},
{
"id": 8,
"pandit_activity_id": 3,
"pandit_id": 1,
"checkIn": "2020-08-24 02:23:19",
"checkOut": null,
"created_at": "2020-08-23T20:53:19.000000Z",
"updated_at": "2020-08-23T20:53:19.000000Z"
},
{
"id": 9,
"pandit_activity_id": 3,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-24 02:23:27",
"created_at": "2020-08-23T20:53:27.000000Z",
"updated_at": "2020-08-23T20:53:27.000000Z"
},
{
"id": 10,
"pandit_activity_id": 5,
"pandit_id": 1,
"checkIn": "2020-08-24 15:08:02",
"checkOut": null,
"created_at": "2020-08-24T09:38:02.000000Z",
"updated_at": "2020-08-24T09:38:02.000000Z"
},
{
"id": 11,
"pandit_activity_id": 5,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-24 15:08:06",
"created_at": "2020-08-24T09:38:06.000000Z",
"updated_at": "2020-08-24T09:38:06.000000Z"
},
{
"id": 12,
"pandit_activity_id": 8,
"pandit_id": 1,
"checkIn": "2020-08-24 22:27:05",
"checkOut": null,
"created_at": "2020-08-24T16:57:05.000000Z",
"updated_at": "2020-08-24T16:57:05.000000Z"
},
{
"id": 13,
"pandit_activity_id": 8,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-24 22:27:09",
"created_at": "2020-08-24T16:57:09.000000Z",
"updated_at": "2020-08-24T16:57:09.000000Z"
},
{
"id": 14,
"pandit_activity_id": 8,
"pandit_id": 1,
"checkIn": "2020-08-24 22:27:37",
"checkOut": null,
"created_at": "2020-08-24T16:57:37.000000Z",
"updated_at": "2020-08-24T16:57:37.000000Z"
},
{
"id": 15,
"pandit_activity_id": 8,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-24 22:27:43",
"created_at": "2020-08-24T16:57:43.000000Z",
"updated_at": "2020-08-24T16:57:43.000000Z"
},
{
"id": 16,
"pandit_activity_id": 8,
"pandit_id": 1,
"checkIn": "2020-08-24 22:36:47",
"checkOut": null,
"created_at": "2020-08-24T17:06:47.000000Z",
"updated_at": "2020-08-24T17:06:47.000000Z"
},
{
"id": 17,
"pandit_activity_id": 8,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-24 22:36:51",
"created_at": "2020-08-24T17:06:51.000000Z",
"updated_at": "2020-08-24T17:06:51.000000Z"
},
{
"id": 18,
"pandit_activity_id": 4,
"pandit_id": 1,
"checkIn": "2020-08-26 14:31:12",
"checkOut": null,
"created_at": "2020-08-26T09:01:12.000000Z",
"updated_at": "2020-08-26T09:01:12.000000Z"
},
{
"id": 19,
"pandit_activity_id": 4,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-26 14:32:04",
"created_at": "2020-08-26T09:02:04.000000Z",
"updated_at": "2020-08-26T09:02:04.000000Z"
},
{
"id": 20,
"pandit_activity_id": 6,
"pandit_id": 1,
"checkIn": "2020-08-26 14:32:21",
"checkOut": null,
"created_at": "2020-08-26T09:02:21.000000Z",
"updated_at": "2020-08-26T09:02:21.000000Z"
},
{
"id": 21,
"pandit_activity_id": 6,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-26 15:14:01",
"created_at": "2020-08-26T09:44:01.000000Z",
"updated_at": "2020-08-26T09:44:01.000000Z"
},
{
"id": 22,
"pandit_activity_id": 14,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-26 15:25:46",
"created_at": "2020-08-26T09:55:46.000000Z",
"updated_at": "2020-08-26T09:55:46.000000Z"
},
{
"id": 23,
"pandit_activity_id": 7,
"pandit_id": 1,
"checkIn": "2020-08-26 16:04:40",
"checkOut": null,
"created_at": "2020-08-26T10:34:40.000000Z",
"updated_at": "2020-08-26T10:34:40.000000Z"
},
{
"id": 24,
"pandit_activity_id": 7,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-26 16:04:58",
"created_at": "2020-08-26T10:34:58.000000Z",
"updated_at": "2020-08-26T10:34:58.000000Z"
},
{
"id": 25,
"pandit_activity_id": 14,
"pandit_id": 1,
"checkIn": "2020-08-26 16:06:17",
"checkOut": null,
"created_at": "2020-08-26T10:36:17.000000Z",
"updated_at": "2020-08-26T10:36:17.000000Z"
},
{
"id": 26,
"pandit_activity_id": 14,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-26 16:06:31",
"created_at": "2020-08-26T10:36:31.000000Z",
"updated_at": "2020-08-26T10:36:31.000000Z"
},
{
"id": 27,
"pandit_activity_id": 4,
"pandit_id": 1,
"checkIn": "2020-08-26 16:07:04",
"checkOut": null,
"created_at": "2020-08-26T10:37:04.000000Z",
"updated_at": "2020-08-26T10:37:04.000000Z"
},
{
"id": 28,
"pandit_activity_id": 4,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-26 16:07:14",
"created_at": "2020-08-26T10:37:14.000000Z",
"updated_at": "2020-08-26T10:37:14.000000Z"
},
{
"id": 29,
"pandit_activity_id": 14,
"pandit_id": 1,
"checkIn": "2020-08-26 16:08:29",
"checkOut": null,
"created_at": "2020-08-26T10:38:29.000000Z",
"updated_at": "2020-08-26T10:38:29.000000Z"
},
{
"id": 30,
"pandit_activity_id": 14,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-26 16:08:37",
"created_at": "2020-08-26T10:38:37.000000Z",
"updated_at": "2020-08-26T10:38:37.000000Z"
},
{
"id": 31,
"pandit_activity_id": 3,
"pandit_id": 1,
"checkIn": "2020-08-26 16:53:51",
"checkOut": null,
"created_at": "2020-08-26T11:23:51.000000Z",
"updated_at": "2020-08-26T11:23:51.000000Z"
},
{
"id": 32,
"pandit_activity_id": 3,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-26 16:54:22",
"created_at": "2020-08-26T11:24:22.000000Z",
"updated_at": "2020-08-26T11:24:22.000000Z"
},
{
"id": 33,
"pandit_activity_id": 15,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-26 20:54:17",
"created_at": "2020-08-26T15:24:17.000000Z",
"updated_at": "2020-08-26T15:24:17.000000Z"
},
{
"id": 34,
"pandit_activity_id": 15,
"pandit_id": 1,
"checkIn": "2020-08-26 20:54:31",
"checkOut": null,
"created_at": "2020-08-26T15:24:31.000000Z",
"updated_at": "2020-08-26T15:24:31.000000Z"
},
{
"id": 35,
"pandit_activity_id": 15,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-26 20:54:53",
"created_at": "2020-08-26T15:24:53.000000Z",
"updated_at": "2020-08-26T15:24:53.000000Z"
},
{
"id": 36,
"pandit_activity_id": 15,
"pandit_id": 1,
"checkIn": "2020-08-26 20:55:03",
"checkOut": null,
"created_at": "2020-08-26T15:25:03.000000Z",
"updated_at": "2020-08-26T15:25:03.000000Z"
},
{
"id": 37,
"pandit_activity_id": 2,
"pandit_id": 1,
"checkIn": "2020-08-26 21:41:51",
"checkOut": null,
"created_at": "2020-08-26T16:11:51.000000Z",
"updated_at": "2020-08-26T16:11:51.000000Z"
},
{
"id": 38,
"pandit_activity_id": 2,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-26 21:44:37",
"created_at": "2020-08-26T16:14:37.000000Z",
"updated_at": "2020-08-26T16:14:37.000000Z"
},
{
"id": 39,
"pandit_activity_id": 16,
"pandit_id": 1,
"checkIn": "2020-08-26 21:44:59",
"checkOut": null,
"created_at": "2020-08-26T16:14:59.000000Z",
"updated_at": "2020-08-26T16:14:59.000000Z"
},
{
"id": 40,
"pandit_activity_id": 16,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-26 21:45:03",
"created_at": "2020-08-26T16:15:03.000000Z",
"updated_at": "2020-08-26T16:15:03.000000Z"
},
{
"id": 41,
"pandit_activity_id": 3,
"pandit_id": 1,
"checkIn": "2020-08-27 01:12:45",
"checkOut": null,
"created_at": "2020-08-26T19:42:45.000000Z",
"updated_at": "2020-08-26T19:42:45.000000Z"
},
{
"id": 42,
"pandit_activity_id": 3,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-27 01:12:48",
"created_at": "2020-08-26T19:42:48.000000Z",
"updated_at": "2020-08-26T19:42:48.000000Z"
},
{
"id": 45,
"pandit_activity_id": 16,
"pandit_id": 1,
"checkIn": "2020-08-31 14:48:36",
"checkOut": null,
"created_at": "2020-08-31T09:18:36.000000Z",
"updated_at": "2020-08-31T09:18:36.000000Z"
},
{
"id": 46,
"pandit_activity_id": 16,
"pandit_id": 1,
"checkIn": null,
"checkOut": "2020-08-31 14:51:22",
"created_at": "2020-08-31T09:21:22.000000Z",
"updated_at": "2020-08-31T09:21:22.000000Z"
},
{
"id": 47,
"pandit_activity_id": 16,
"pandit_id": 1,
"checkIn": "2020-08-31 14:51:39",
"checkOut": null,
"created_at": "2020-08-31T09:21:39.000000Z",
"updated_at": "2020-08-31T09:21:39.000000Z"
}
],
"payments": [
]
}
User.dart
import 'dart:convert';
import 'package:PandeetApp/services/activity.dart';
class User {
int id;
String name;
String mobile;
String smsToken;
String mobileVerifiedAt;
String email;
String emailToken;
Null emailVerifiedAt;
String password;
String rememberToken;
String avatar;
String address;
String city;
String state;
String country;
int pincode;
int locationId;
String travelled;
String adharcard;
String pancard;
String specialisation;
List services;
String minCharge;
String maxCharge;
String onlineCharge;
String qualification;
String experience;
String language;
String active;
String varify;
PaymentMode paymentMode;
String createdAt;
String updatedAt;
String rating;
List<Clients> clients;
List<Visits> visits;
List<Payments> payments;
User({
this.id,
this.name,
this.mobile,
this.smsToken,
this.mobileVerifiedAt,
this.email,
this.emailToken,
this.emailVerifiedAt,
this.password,
this.rememberToken,
this.avatar,
this.address,
this.city,
this.state,
this.country,
this.pincode,
this.locationId,
this.travelled,
this.adharcard,
this.pancard,
this.specialisation,
this.services,
this.minCharge,
this.maxCharge,
this.onlineCharge,
this.qualification,
this.experience,
this.language,
this.active,
this.varify,
this.paymentMode,
this.createdAt,
this.updatedAt,
this.rating,
this.clients,
this.visits,
this.payments,
});
Future<User> fetchData() async {
var data = await PanditActivity().profile();
// print(data);
return new User.fromJson(data);
}
User.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
mobile = json['mobile'];
smsToken = json['sms_token'];
mobileVerifiedAt = json['mobile_verified_at'];
email = json['email'];
emailToken = json['email_token'];
emailVerifiedAt = json['email_verified_at'];
password = json['password'];
rememberToken = json['remember_token'];
avatar = json['avatar'];
address = json['address'];
city = json['city'];
state = json['state'];
country = json['country'];
pincode = json['pincode'];
locationId = json['location_id'];
travelled = json['travelled'];
adharcard = json['adharcard'];
pancard = json['pancard'];
specialisation = json['specialisation'];
services = jsonDecode(json['services']) ?? [];
minCharge = json['min_charge'];
maxCharge = json['max_charge'];
onlineCharge = json['online_charge'];
qualification = json['qualification'];
experience = json['experience'];
language = json['language'];
active = json['active'];
varify = json['varify'];
paymentMode = json['payment_mode'] != null
? new PaymentMode.fromJson(jsonDecode(json['payment_mode']))
: PaymentMode();
createdAt = json['created_at'];
updatedAt = json['updated_at'];
rating = json['rating'];
if (json['clients'] != null) {
clients = new List<Clients>();
json['clients'].forEach((v) {
clients.add(new Clients.fromJson(v));
});
}
if (json['visits'] != null) {
visits = new List<Visits>();
json['visits'].forEach((v) {
visits.add(new Visits.fromJson(v));
});
}
if (json['payments'] != null) {
payments = new List<Payments>();
json['payments'].forEach((v) {
payments.add(new Payments.fromJson(v));
});
}
}
Map<String, String> toJson() {
final Map<String, String> data = new Map<String, String>();
data['id'] = this.id.toString();
data['name'] = this.name;
data['mobile'] = this.mobile;
data['sms_token'] = this.smsToken;
data['mobile_verified_at'] = this.mobileVerifiedAt;
data['email'] = this.email;
data['email_token'] = this.emailToken;
data['email_verified_at'] = this.emailVerifiedAt;
data['password'] = this.password;
data['remember_token'] = this.rememberToken;
data['avatar'] = this.avatar;
data['address'] = this.address;
data['city'] = this.city;
data['state'] = this.state;
data['country'] = this.country;
data['pincode'] = this.pincode.toString();
data['location_id'] = this.locationId.toString();
data['travelled'] = this.travelled;
data['adharcard'] = this.adharcard;
data['pancard'] = this.pancard;
data['specialisation'] = this.specialisation;
data['services'] = jsonEncode(this.services);
data['min_charge'] = this.minCharge;
data['max_charge'] = this.maxCharge;
data['online_charge'] = this.onlineCharge;
data['qualification'] = this.qualification;
data['experience'] = this.experience;
data['language'] = this.language;
data['active'] = this.active;
data['varify'] = this.varify;
if (this.paymentMode != null) {
data['payment_mode'] = jsonEncode(this.paymentMode.toJson());
}
data['created_at'] = this.createdAt;
data['updated_at'] = this.updatedAt;
data['rating'] = this.rating;
if (this.clients != null) {
data['clients'] = this.clients.map((v) => v.toJson()).toList().toString();
}
if (this.visits != null) {
data['visits'] = this.visits.map((v) => v.toJson()).toList().toString();
}
if (this.payments != null) {
data['payments'] =
this.payments.map((v) => v.toJson()).toList().toString();
}
return data;
}
}
class PaymentMode {
String bankName;
String bankAddress;
String ifscCode;
String accountNo;
String accountHolder;
PaymentMode(
{this.bankName, this.ifscCode, this.accountNo, this.accountHolder});
PaymentMode.fromJson(Map<String, dynamic> json) {
bankName = json['bank_name'];
bankAddress = json['bank_address'];
ifscCode = json['ifsc_code'];
accountNo = json['account_no'];
accountHolder = json['account_holder'];
}
Map<String, String> toJson() {
final Map<String, String> data = new Map<String, String>();
data['bank_name'] = this.bankName;
data['bank_address'] = this.bankAddress;
data['ifsc_code'] = this.ifscCode;
data['account_no'] = this.accountNo;
data['account_holder'] = this.accountHolder;
return data;
}
}
class Clients {
int id;
int clientId;
String perpose;
String details;
String when;
int acceptedBy;
String name;
String mobile;
String email;
String orgName;
String address;
String city;
String state;
String pincode;
String country;
String latitude;
String longitude;
String clientIp;
String device;
String createdAt;
String updatedAt;
Clients(
{this.id,
this.clientId,
this.perpose,
this.details,
this.when,
this.acceptedBy,
this.name,
this.mobile,
this.email,
this.orgName,
this.address,
this.city,
this.state,
this.pincode,
this.country,
this.latitude,
this.longitude,
this.clientIp,
this.device,
this.createdAt,
this.updatedAt});
Clients.fromJson(Map<String, dynamic> json) {
id = json['id'];
clientId = json['client_id'];
perpose = json['perpose'];
details = json['details'];
when = json['when'];
acceptedBy = json['accepted_by'];
name = json['name'];
mobile = json['mobile'];
email = json['email'];
orgName = json['org_name'];
address = json['address'];
city = json['city'];
state = json['state'];
pincode = json['pincode'];
country = json['country'];
latitude = json['latitude'];
longitude = json['longitude'];
clientIp = json['client_ip'];
device = json['device'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
}
Map<String, String> toJson() {
final Map<String, String> data = new Map<String, String>();
data['id'] = this.id.toString();
data['client_id'] = this.clientId.toString();
data['perpose'] = this.perpose;
data['details'] = this.details;
data['when'] = this.when;
data['accepted_by'] = this.acceptedBy.toString();
data['name'] = this.name;
data['mobile'] = this.mobile;
data['email'] = this.email;
data['org_name'] = this.orgName;
data['address'] = this.address;
data['city'] = this.city;
data['state'] = this.state;
data['pincode'] = this.pincode;
data['country'] = this.country;
data['latitude'] = this.latitude;
data['longitude'] = this.longitude;
data['client_ip'] = this.clientIp;
data['device'] = this.device;
data['created_at'] = this.createdAt;
data['updated_at'] = this.updatedAt;
return data;
}
}
class Visits {
int id;
int panditActivityId;
int panditId;
String checkIn;
String checkOut;
String createdAt;
String updatedAt;
Visits(
{this.id,
this.panditActivityId,
this.panditId,
this.checkIn,
this.checkOut,
this.createdAt,
this.updatedAt});
Visits.fromJson(Map<String, dynamic> json) {
id = json['id'];
panditActivityId = json['pandit_activity_id'];
panditId = json['pandit_id'];
checkIn = json['checkIn'];
checkOut = json['checkOut'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
}
Map<String, String> toJson() {
final Map<String, String> data = new Map<String, String>();
data['id'] = this.id.toString();
data['pandit_activity_id'] = this.panditActivityId.toString();
data['pandit_id'] = this.panditId.toString();
data['checkIn'] = this.checkIn;
data['checkOut'] = this.checkOut;
data['created_at'] = this.createdAt;
data['updated_at'] = this.updatedAt;
return data;
}
}
class Payments {
int id;
int panditId;
String details;
String mode;
String creditAmt;
String debitAmt;
String createdAt;
String updatedAt;
Payments(
{this.id,
this.panditId,
this.details,
this.mode,
this.creditAmt,
this.debitAmt,
this.createdAt,
this.updatedAt});
Payments.fromJson(Map<String, dynamic> json) {
id = json['id'];
panditId = json['pandit_id'];
details = json['details'];
mode = json['mode'];
creditAmt = json['credit_amt'].toString();
debitAmt = json['debit_amt'].toString();
createdAt = json['created_at'];
updatedAt = json['updated_at'];
}
Map<String, String> toJson() {
final Map<String, String> data = new Map<String, String>();
data['id'] = this.id.toString();
data['pandit_id'] = this.panditId.toString();
data['details'] = this.details;
data['mode'] = this.mode;
data['credit_amt'] = this.creditAmt;
data['debit_amt'] = this.debitAmt;
data['created_at'] = this.createdAt;
data['updated_at'] = this.updatedAt;
return data;
}
}
我认为可能是来自user.dart的问题。但是我不明白,问题出在哪里。谢谢大家。