diff --git a/lib/inventree/stock.dart b/lib/inventree/stock.dart index ebd9cdb6..fa7c4e8b 100644 --- a/lib/inventree/stock.dart +++ b/lib/inventree/stock.dart @@ -246,11 +246,11 @@ class InvenTreeStockItem extends InvenTreeModel { } } - String? get updatedDateString { + String get updatedDateString { var _updated = updatedDate; if (_updated == null) { - return null; + return ""; } final DateFormat _format = DateFormat("yyyy-MM-dd"); @@ -266,11 +266,11 @@ class InvenTreeStockItem extends InvenTreeModel { } } - String? get stocktakeDateString { + String get stocktakeDateString { var _stocktake = stocktakeDate; if (_stocktake == null) { - return null; + return ""; } final DateFormat _format = DateFormat("yyyy-MM-dd"); diff --git a/lib/widget/stock_detail.dart b/lib/widget/stock_detail.dart index b1f64123..2f7e6103 100644 --- a/lib/widget/stock_detail.dart +++ b/lib/widget/stock_detail.dart @@ -479,27 +479,23 @@ class _StockItemDisplayState extends RefreshableState { } // Last update? - var update_date = item.updatedDateString; - - if (update_date != null) { + if (item.updatedDateString.isNotEmpty) { tiles.add( ListTile( title: Text(L10().lastUpdated), - subtitle: Text(update_date), + subtitle: Text(item.updatedDateString), leading: FaIcon(FontAwesomeIcons.calendarAlt) ) ); } // Stocktake? - var stocktake_date = item.stocktakeDateString; - - if (stocktake_date != null) { + if (item.stocktakeDateString.isNotEmpty) { tiles.add( ListTile( title: Text(L10().lastStocktake), - subtitle: Text(stocktake_date), + subtitle: Text(item.stocktakeDateString), leading: FaIcon(FontAwesomeIcons.calendarAlt) ) );