Instrument.fromMap constructor
Instrument.fromMap(
- Map<String, dynamic> map
)
Implementation
factory Instrument.fromMap(Map<String, dynamic> map) {
return Instrument(
id: map['id'] ?? '',
type: PaymentMethod.values
.firstWhere((e) => e.name.toLowerCase() == map["type"]),
fingerprint: map['fingerprint'] ?? '',
expiryMonth: map['expiry_month']?.toInt() ?? 0,
expiryYear: map['expiry_year']?.toInt() ?? 0,
last4: map['last4'] ?? '',
bin: map['bin'] ?? '',
scheme: map['scheme'] ?? '',
isDefault:
map["customer"] != null ? map["customer"]["default"] : false);
}