Files
eatvio_app/lib/features/plans/repositories/plans_repository.dart

20 lines
633 B
Dart

import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
import 'package:eatvio_app/features/plans/services/plans_service.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
class PlansRepository {
final PlansService plansService;
PlansRepository({required this.plansService});
Future<List<PlanModel>> getPlansBySlug(String slug) async {
try {
final plans = (await plansService.getPlansBySlug(author: slug)).data;
return plans.where((plan) => plan.state == 'active').toList();
} catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
rethrow;
}
}
}