getBestSupplier method Null safety

Future<ProductListSupplier> getBestSupplier(
  1. dynamic productQuery,
  2. dynamic localDatabase
)

Returns the fastest data supplier: database if possible, or server query

Implementation

static Future<ProductListSupplier> getBestSupplier(
  final PagedProductQuery productQuery,
  final LocalDatabase localDatabase,
) async {
  final int? timestamp = DaoProductList(localDatabase).getTimestamp(
    productQuery.getProductList(),
  );
  return timestamp == null
      ? QueryProductListSupplier(productQuery, localDatabase)
      : DatabaseProductListSupplier(productQuery, localDatabase, timestamp);
}