BaseRepository<T extends JsonModel, TFilter extends DataFilter> class abstract

An abstract class that extends ApiClient to provide base CRUD operations for repositories.

This class provides methods for listing, counting, retrieving, creating, updating, deleting, approving, and rejecting entities of type T that extends JsonModel. The operations use Dio for HTTP requests and handle responses appropriately.

Inheritance
Implementers

Constructors

BaseRepository.new({bool shouldUseDeviceInfo = false, bool shouldUsePersistentUrl = false})

Properties

baseUrl String
The base URL for API requests.
no setterinherited
cookieStorage CookieManager
no setterinherited
dio → Dio
finalinherited
hashCode int
The hash code for this object.
no setterinherited
persistentStorage PersistentStorage
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secureStorage SecureStorage
no setterinherited

Methods

approve(T entity) Future<T>
Approves an entity based on the entity object.
approveById(num id) Future<T>
Approves an entity based on its ID.
count(TFilter filter) Future<int>
Counts entities based on the provided filter.
create(T entity) Future<T>
Creates a new entity.
deleteByEntity(T entity) Future<T>
Deletes an entity based on the entity object.
deleteById(num id) Future<T>
Deletes an entity based on its ID.
downloadBytes(String url) Future<Uint8List>
Downloads content as bytes from a URL.
inherited
downloadFile({required String url, required String savePath, required String filename}) Future<File?>
Downloads content to a file.
inherited
getById(num id) Future<T>
Retrieves an entity by its ID.
list(TFilter filter) Future<List<T>>
Lists entities based on the provided filter.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reject(T entity) Future<T>
Rejects an entity based on the entity object.
rejectById(num id) Future<T>
Rejects an entity based on its ID.
toString() String
A string representation of this object.
inherited
update(T entity) Future<T>
Updates an existing entity.
uploadFile({required String filePath, String uploadUrl = "/upload-file", String? filename}) Future<File>
Uploads a single file.
inherited
uploadFileFromFilePicker(PlatformFile file, {String uploadUrl = "/upload-file"}) Future<File>
Uploads a file using PlatformFile.
inherited
uploadFileFromImagePicker(XFile file, {String uploadUrl = "/upload-file"}) Future<File>
Uploads a file using XFile.
inherited
uploadFiles({required List<String> filePaths, String uploadUrl = "/multi-upload-file"}) Future<List<File>>
Uploads multiple files.
inherited
uploadFilesFromFilePicker(List<PlatformFile> files, {String uploadUrl = "/multi-upload-file"}) Future<List<File>>
Uploads multiple files using PlatformFile.
inherited
uploadFilesFromImagePicker(List<XFile> files, {String uploadUrl = "/multi-upload-file"}) Future<List<File>>
Uploads multiple files using XFile.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited