putListData method

  1. @override
Future<void> putListData({
  1. required Iterable<T> dataList,
  2. bool autoClose = false,
})
override

Implementation

@override
Future<void> putListData({
  required Iterable<T> dataList,
  bool autoClose = false,
}) async {
  try {
    debugPrint('====================Put Data=================');
    int x = 0;
    await Future.wait(dataList.map((val) async {
      if (_box != null) {
        await _box!.add(val);
      }
      if (_lazyBox != null) {
        await _lazyBox!.add(val);
      }
      x++;
      debugPrint('key $x : $val');
    }));

    debugPrint('=============================================');
  } catch (e) {
    debugPrint('================Put Data Failed==============');
    debugPrint(e.toString());
    debugPrint('=============================================');
  } finally {
    if (autoClose) {
      await close();
    }
  }

  return;
}