25 lines
577 B
Dart
25 lines
577 B
Dart
class TransactionModel {
|
|
final String id;
|
|
final String userId;
|
|
final int nominal;
|
|
final String tipe;
|
|
final DateTime? createdAt;
|
|
|
|
TransactionModel({
|
|
required this.id,
|
|
required this.userId,
|
|
required this.nominal,
|
|
required this.tipe,
|
|
this.createdAt,
|
|
});
|
|
|
|
factory TransactionModel.fromMap(String id, Map<String, dynamic> map) {
|
|
return TransactionModel(
|
|
id: id,
|
|
userId: map['userId'] ?? '',
|
|
nominal: (map['nominal'] ?? 0).toInt(),
|
|
tipe: map['tipe'] ?? 'masuk',
|
|
createdAt: map['createdAt']?.toDate(),
|
|
);
|
|
}
|
|
} |