import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_livestock/data/model/local/location/tmp_locations.dart';

class TmpLocalDataSource {
  Future<void> addLocations(List<TmpLocations> list) async {
    IsolatedBox<TmpLocations> box = await IsolatedHive.openBox<TmpLocations>('TmpBox');
    if (await box.isNotEmpty) {
      box.clear();
    }
    box.addAll(list);
  }

  Future<List<TmpLocations>> getLocations() async {
    IsolatedBox<TmpLocations> box = await IsolatedHive.openBox<TmpLocations>('TmpBox');
    var res = await box.values;
    return res.toList();
  }
}
