extractArticlesPhotosFromParsedExcel property

List<ArticlePhoto> get extractArticlesPhotosFromParsedExcel

Implementation

List<ArticlePhoto> get extractArticlesPhotosFromParsedExcel {
  final photosList = <ArticlePhoto>[];
  final now = DateTime.now();
  for (var i = 0; i < length; i++) {
    final table = this[i];
    final newPhoto = ArticlePhoto(
        calibreId: table[0] != null
            ? table[0].runtimeType == int
                ? table[0]
                : int.tryParse(table[1])
            : 0,
        id: table[1] != null
            ? table[1].runtimeType == int
                ? table[1]
                : int.tryParse(table[1])
            : 0,
        path: table[3] != null ? table[3].toString().trim() : '',
        source: PhotoSource.file,
        dateUTC: now.toUtc());
    photosList.add(newPhoto);
  }
  return photosList;
}