fetchUsers method
Implementation
Future<dartz.Either<String, List<User>>> fetchUsers() async {
final response = await http.get(Uri.parse('https://fakestoreapi.com/users'));
if (response.statusCode == 200) {
final List<dynamic> jsonData = json.decode(response.body);
final users = jsonData.map((json) => User.fromJson(json)).toList();
return dartz.Right(users);
} else {
return dartz.Left('Failed to load users');
}
}