23 lines
627 B
Dart
23 lines
627 B
Dart
import 'package:intl/intl.dart';
|
|
|
|
class CustomerMembership {
|
|
late int membershipId;
|
|
int? customerId;
|
|
DateTime? startDate;
|
|
|
|
CustomerMembership.fromJson(Map json) {
|
|
membershipId = json['membershipId'];
|
|
customerId = json['customerId'] ?? 0;
|
|
startDate = json['startDate'] == null ? null : DateTime.parse(json['startDate']);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"membershipId": membershipId,
|
|
"customerId": customerId ?? 0,
|
|
"startDate": startDate == null ? "" : DateFormat('yyyy-MM-dd HH:mm:ss').format(startDate!),
|
|
};
|
|
|
|
@override
|
|
String toString() => toJson().toString();
|
|
}
|