getSavedItems method

  1. @override
Future<Either<Failure, List<MyLogModel>>> getSavedItems()
override

Implementation

@override
Future<Either<Failure, List<MyLogModel>>> getSavedItems() async {
  try {
    final String jsonString =
        _sharedPref.getString(local_saved_items_logs) ?? "";
    final List<dynamic> jsonList = jsonDecode(jsonString);
    final List<MyLogModel> objects =
        jsonList.map((json) => MyLogModel.fromJson(json)).toList();
    return Right(objects);
  } catch (e) {
    return const Right([]);
  }
}