PDF テンプレート型エラー修正\n- 可変長パラメータに初期値付与\n- fromMap メソッドで null セーフ化\n\nビルド完了(48.8MB)

This commit is contained in:
joe 2026-03-08 17:09:05 +09:00
parent 44f21da2a9
commit 9f4f6ae3ef

View file

@ -10,21 +10,21 @@ class SalesInvoiceTemplate {
final String taxRate; final String taxRate;
const SalesInvoiceTemplate({ const SalesInvoiceTemplate({
required this.invoiceNumber, this.invoiceNumber = '',
required this.date, this.date = '',
required this.customerName, this.customerName = '',
required this.items, this.items = const <Map<String, dynamic>>[],
required this.totalAmount, this.totalAmount = 0,
this.taxRate = '8', this.taxRate = '8',
}); });
factory SalesInvoiceTemplate.fromMap(Map<String, dynamic> data) { factory SalesInvoiceTemplate.fromMap(Map<String, dynamic> data) {
return const SalesInvoiceTemplate( return SalesInvoiceTemplate(
invoiceNumber: '', invoiceNumber: data['invoice'] as String? ?? '',
date: '', date: data['date'] as String? ?? '',
customerName: '', customerName: data['customer_name'] as String? ?? '',
items: [], items: (data['items'] as List<dynamic>?)?.map((e) => e as Map<String, dynamic>).toList() ?? const <Map<String, dynamic>>[],
totalAmount: 0, totalAmount: (data['total'] as int?) ?? 0,
); );
} }