You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

25 lines
839 B

import 'package:hadi_hoda_flutter/core/constants/my_constants.dart';
import 'package:hadi_hoda_flutter/core/error_handler/my_exception.dart';
import 'package:hadi_hoda_flutter/core/params/level_params.dart';
import 'package:hadi_hoda_flutter/features/level/domain/entity/level_entity.dart';
import 'package:hive/hive.dart';
abstract class ILevelDatasource {
Future<List<LevelEntity>> getLevels({required LevelParams params});
}
/// Local
class LocalLevelDatasourceImpl implements ILevelDatasource {
const LocalLevelDatasourceImpl();
@override
Future<List<LevelEntity>> getLevels({required LevelParams params}) async {
try {
final Box<LevelEntity> levelBox = Hive.box(MyConstants.levelBox);
return levelBox.values.toList();
} catch (_) {
throw MyException(errorMessage: 'Operation Failed');
}
}
}