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
Properties
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 the content from the specified URL as a Uint8List.
inherited
-
downloadFile(
String url, {required String savePath, required String filename}) → Future< File?> -
Downloads the content from the specified URL and saves it 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"}) → Future< File> -
Uploads a file to the specified upload URL.
inherited
-
uploadFileFromFilePicker(
PlatformFile file, {String uploadUrl = '/upload-file'}) → Future< File> -
Uploads a file from a
PlatformFile
object to the specified upload URL.inherited -
uploadFileFromImagePicker(
XFile file, {String uploadUrl = '/upload-file'}) → Future< File> -
Uploads a file from an
XFile
object to the specified upload URL.inherited -
uploadFiles(
{required List< String> filePaths, String uploadUrl = '/multi-upload-file'}) → Future<List< File> > -
Uploads multiple files to the specified upload URL.
inherited
-
uploadFilesFromFilePicker(
List< PlatformFile> files, {String uploadUrl = '/multi-upload-file'}) → Future<List< File> > -
Uploads multiple files from a list of
PlatformFile
objects to the specified upload URL.inherited -
uploadFilesFromImagePicker(
List< XFile> files, {String uploadUrl = '/multi-upload-file'}) → Future<List< File> > -
Uploads multiple files from a list of
XFile
objects to the specified upload URL.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited