PDF テンプレート型エラー修正\n- 可変長パラメータに初期値付与\n- fromMap メソッドで null セーフ化\n\nビルド完了(48.8MB)
This commit is contained in:
parent
44f21da2a9
commit
9f4f6ae3ef
1 changed files with 11 additions and 11 deletions
|
|
@ -10,21 +10,21 @@ class SalesInvoiceTemplate {
|
|||
final String taxRate;
|
||||
|
||||
const SalesInvoiceTemplate({
|
||||
required this.invoiceNumber,
|
||||
required this.date,
|
||||
required this.customerName,
|
||||
required this.items,
|
||||
required this.totalAmount,
|
||||
this.invoiceNumber = '',
|
||||
this.date = '',
|
||||
this.customerName = '',
|
||||
this.items = const <Map<String, dynamic>>[],
|
||||
this.totalAmount = 0,
|
||||
this.taxRate = '8',
|
||||
});
|
||||
|
||||
factory SalesInvoiceTemplate.fromMap(Map<String, dynamic> data) {
|
||||
return const SalesInvoiceTemplate(
|
||||
invoiceNumber: '',
|
||||
date: '',
|
||||
customerName: '',
|
||||
items: [],
|
||||
totalAmount: 0,
|
||||
return SalesInvoiceTemplate(
|
||||
invoiceNumber: data['invoice'] as String? ?? '',
|
||||
date: data['date'] as String? ?? '',
|
||||
customerName: data['customer_name'] as String? ?? '',
|
||||
items: (data['items'] as List<dynamic>?)?.map((e) => e as Map<String, dynamic>).toList() ?? const <Map<String, dynamic>>[],
|
||||
totalAmount: (data['total'] as int?) ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue