19 lines
503 B
Dart
19 lines
503 B
Dart
import 'package:dartz/dartz.dart';
|
|
|
|
import '../../../../core/errors/failures.dart';
|
|
import '../entities/user_entity.dart';
|
|
import '../repositories/users_repository.dart';
|
|
|
|
/// Use case for getting users
|
|
/// Follows local-first strategy: returns local users if available,
|
|
/// otherwise syncs from API
|
|
class GetUsersUseCase {
|
|
final UsersRepository repository;
|
|
|
|
GetUsersUseCase(this.repository);
|
|
|
|
Future<Either<Failure, List<UserEntity>>> call() async {
|
|
return await repository.getUsers();
|
|
}
|
|
}
|