getUserLists method Null safety

List<String> getUserLists(
  1. {String? withBarcode}
)

Returns the names of the user lists.

Possibly restricted to the user lists that contain the given barcode.

Implementation

List<String> getUserLists({String? withBarcode}) {
  final List<String> result = <String>[];
  for (final dynamic key in _getBox().keys) {
    final String tmp = key.toString();
    final ProductListType productListType = getProductListType(tmp);
    if (productListType != ProductListType.USER) {
      continue;
    }
    if (withBarcode != null) {
      final _BarcodeList? barcodeList = _getBox().get(key);
      if (barcodeList == null ||
          !barcodeList.barcodes.contains(withBarcode)) {
        continue;
      }
    }
    result.add(getProductListParameters(tmp));
  }
  return result;
}