cacheLogs method

  1. @override
Future<Either<Failure, Success>> cacheLogs(
  1. List<MyLogModel> logs
)
override

Implementation

@override
Future<Either<Failure, Success>> cacheLogs(List<MyLogModel> logs) async {
  try {
    final String jsonString =
        jsonEncode(logs.map((obj) => obj.toJson()).toList());
    _sharedPref.setString(local_key_logs, jsonString);
    return Right(CacheSuccess());
  } catch (e) {
    return Left(LocalDatasourceFailure());
  }
}