ClosingStockArticle.fromMap constructor

ClosingStockArticle.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory ClosingStockArticle.fromMap(Map<String, dynamic> map) {
  return ClosingStockArticle(
    DateTime.tryParse(map['closingDate'] ?? '') ?? DatesWeebi.defaultDate,
    id: map['id'] ?? map['articleId'] as int,
    calibreId: map['calibreId'] as int,
    // price: map['price'] ?? 0,
    // cost: map['cost'] ?? 0,
    designation: map['designation'] as String,
    unitsInOnePiece: map['unitsInOnePiece'] == null
        ? 1.0
        : (map['unitsInOnePiece'] as num).toDouble(),
    quantityIn: map['quantityIn'] == null
        ? 0.0
        : (map['quantityIn'] as num).toDouble(),
    quantityOut: map['quantityOut'] == null
        ? 0.0
        : (map['quantityOut'] as num).toDouble(),
    initialQtCl: map['initialQtCl'] == null
        ? 0.0
        : (map['initialQtCl'] as num).toDouble(),
    finalQtCl:
        map['finalQtCl'] == null ? 0.0 : (map['finalQtCl'] as num).toDouble(),
    price: map['price'] == null ? 0.0 : (map['price'] as num).toDouble(),
    cost: map['cost'] == null ? 0.0 : (map['cost'] as num).toDouble(),
  );
}