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 toJson() => { "membershipId": membershipId, "customerId": customerId ?? 0, "startDate": startDate == null ? "" : DateFormat('yyyy-MM-dd HH:mm:ss').format(startDate!), }; @override String toString() => toJson().toString(); }