rename method Null safety

Future rename(
  1. dynamic initialList,
  2. String newName
)

Implementation

Future<ProductList> rename(
  final ProductList initialList,
  final String newName,
) async {
  final ProductList newList = ProductList.user(newName);
  final _BarcodeList list = _get(initialList) ?? _BarcodeList.now(<String>[]);
  _put(_getKey(newList), list);
  await delete(initialList);
  await get(newList);
  return newList;
}