fix printer
This commit is contained in:
@@ -15,8 +15,19 @@ class PrinterDto with _$PrinterDto {
|
||||
@JsonKey(name: 'updated_at') required DateTime updatedAt,
|
||||
}) = _PrinterDto;
|
||||
|
||||
factory PrinterDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$PrinterDtoFromJson(json);
|
||||
factory PrinterDto.fromJson(Map<String, dynamic> json) => _$PrinterDtoFromJson(
|
||||
// Normalize paper field: SQLite bisa return int atau String
|
||||
{
|
||||
...json,
|
||||
'paper': json['paper']?.toString() ?? '58',
|
||||
'created_at': json['created_at'] is DateTime
|
||||
? (json['created_at'] as DateTime).toIso8601String()
|
||||
: json['created_at'],
|
||||
'updated_at': json['updated_at'] is DateTime
|
||||
? (json['updated_at'] as DateTime).toIso8601String()
|
||||
: json['updated_at'],
|
||||
},
|
||||
);
|
||||
|
||||
// Optional mapper to domain
|
||||
Printer toDomain() => Printer(
|
||||
|
||||
@@ -674,6 +674,7 @@ class PrinterRepository implements IPrinterRepository {
|
||||
if (printResult.isLeft()) return printResult.map((_) => unit);
|
||||
|
||||
log('Finished printed receipt', name: _logName);
|
||||
log('Printer Size: ', name: printer.paper);
|
||||
|
||||
return right(unit);
|
||||
} catch (e, stackTrace) {
|
||||
|
||||
Reference in New Issue
Block a user