Reputation: 1
I have an abstract Repository<T>
class in Dart that defines several methods, as shown below:
import 'package:qkons/core/errors/failures.dart';
import 'package:qkons/core/pagination/pagination_params.dart';
import 'package:qkons/core/pagination/pagination_res.dart';
abstract class Repository<T> {
Future<({Failure? failure, T? value})> getOneById(
{required String token, required String id});
Future<({Failure? failure, PaginationResponse<T>? value})> getMany(
{required String token, required PaginationParams params});
Future<({Failure? failure, bool? value})> addOne(
{required String token, required T value});
Future<({Failure? failure, bool? value})> addMany(
{required String token, required List<T> value});
Future<({Failure? failure, bool? value})> deleteOne(
{required String token, required String id});
Future<({Failure? failure, bool? value})> deleteMany(
{required String token, required List<String> ids});
Future<({Failure? failure, bool? value})> enableTracking(
{required String token});
Future<({Failure? failure, bool? value})> disableTracking(
{required String token});
}
I have a specific feature where an implementation of this repository requires different parameters than what's defined in the abstract class. For example, the addOne
method may need an additional parameter, or the getMany
method may need fewer parameters.
I'm aiming to maintain a clean architecture and keep my code extensible for future features. I want to avoid breaking the current design or introducing unnecessary complexity.
Any suggestions or examples would be greatly appreciated!
Upvotes: 0
Views: 26