DataSource<T extends Entity<EntityKey>> class abstract

Won't Use Directly

You can use:

  • ApiDataSource : Use for Api related data.
  • FireStoreDataSource : Use for Firebase Cloud firestore related data.
  • RealtimeDataSource : Use for Firebase realtime database related data.
  • LocalDataSourceImpl : Use for local or save instance related data.

A data source for handling cached data operations.

Example:

class LocalUserDataSource extends LocalDataSourceImpl {
  // Implement local data source operations for User entities.
}

A data source for handling api based data operations.

Example:

class ApiUserDataSource extends ApiDataSource {
  // Implement api based data source operations for User entities.
}

A data source for handling Firestore database operations.

Example:

class FirestoreUserDataSource extends FirestoreDataSource {
  // Implement Firestore data source operations for User entities.
}

A data source for handling Realtime database operations.

Example:

class RealtimeUserDataSource extends RealtimeDataSource {
  // Implement real-time data source operations for User entities.
}

Abstract class representing a generic data repository with methods for CRUD operations.

This abstract class defines the structure of a generic data repository. It is not intended to be used directly. Instead, use its implementations:

Example:

final RemoteDataSource remoteUserDataSource = RemoteUserDataSource();
final LocalDataSource localUserDataSource = LocalUserDataSource();
Implementers

Constructors

DataSource({required String path, required DataDelegate delegate, DataEncryptor? encryptor, DataLimitations limitations = const DataLimitations()})
const

Properties

delegate DataDelegate
final
encryptor DataEncryptor?
final
hashCode int
The hash code for this object.
no setterinherited
isEncryptor bool
no setter
limitations DataLimitations
final
operation DataOperation
no setter
path String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(dynamic source) → T
checkById(String id, {DataFieldParams? params, bool? countable, bool resolveRefs = false, Ignore? ignore}) Future<Response<T>>
Method to check data by ID with optional data source builder.
clear({DataFieldParams? params, bool? resolveRefs, bool deleteRefs = false, Ignore? ignore, bool counter = false}) Future<Response<T>>
Method to clear data with optional data source builder.
count({DataFieldParams? params}) Future<Response<int>>
create(String id, Map<String, dynamic> data, {DataFieldParams? params, bool merge = true, bool createRefs = false}) Future<Response<T>>
Method to create data with optional data source builder.
creates(Iterable<DataWriter> writers, {DataFieldParams? params, bool merge = true, bool createRefs = false}) Future<Response<T>>
Method to create multiple data entries with optional data source builder.
deleteById(String id, {DataFieldParams? params, bool? resolveRefs, Ignore? ignore, bool deleteRefs = false, bool counter = false}) Future<Response<T>>
Method to delete data by ID with optional data source builder.
deleteByIds(Iterable<String> ids, {DataFieldParams? params, bool? resolveRefs, Ignore? ignore, bool deleteRefs = false, bool counter = false}) Future<Response<T>>
Method to delete data by multiple IDs with optional data source builder.
execute<S extends Object>(Future<Response<S>> callback()) Future<Response<S>>
executeStream<S extends Object>(Stream<Response<S>> callback()) Stream<Response<S>>
get({DataFieldParams? params, bool onlyUpdates = false, bool? countable, bool resolveRefs = false, bool resolveDocChangesRefs = false, Ignore? ignore}) Future<Response<T>>
Method to get data with optional data source builder.
getById(String id, {DataFieldParams? params, bool? countable, bool resolveRefs = false, Ignore? ignore}) Future<Response<T>>
Method to get data by ID with optional data source builder.
getByIds(Iterable<String> ids, {DataFieldParams? params, bool? countable, bool resolveRefs = false, bool resolveDocChangesRefs = false, Ignore? ignore}) Future<Response<T>>
Method to get data by multiple IDs with optional data source builder.
getByQuery({DataFieldParams? params, Iterable<DataQuery> queries = const [], Iterable<DataSelection> selections = const [], Iterable<DataSorting> sorts = const [], DataPagingOptions options = const DataPagingOptions(), bool? countable, bool onlyUpdates = false, bool resolveRefs = false, bool resolveDocChangesRefs = false, Ignore? ignore}) Future<Response<T>>
Method to get data by query with optional data source builder.
listen({DataFieldParams? params, bool? countable, bool onlyUpdates = false, bool resolveRefs = false, bool resolveDocChangesRefs = false, Ignore? ignore}) Stream<Response<T>>
Stream method to listen for data changes with optional data source builder.
listenById(String id, {DataFieldParams? params, bool? countable, bool resolveRefs = false, Ignore? ignore}) Stream<Response<T>>
Stream method to listen for data changes by ID with optional data source builder.
listenByIds(Iterable<String> ids, {DataFieldParams? params, bool? countable, bool resolveRefs = false, bool resolveDocChangesRefs = false, Ignore? ignore}) Stream<Response<T>>
Stream method to listen for data changes by multiple IDs with optional data source builder.
listenByQuery({DataFieldParams? params, Iterable<DataQuery> queries = const [], Iterable<DataSelection> selections = const [], Iterable<DataSorting> sorts = const [], DataPagingOptions options = const DataPagingOptions(), bool? countable, bool onlyUpdates = false, bool resolveRefs = false, bool resolveDocChangesRefs = false, Ignore? ignore}) Stream<Response<T>>
Stream method to listen for data changes by query with optional data source builder.
listenCount({DataFieldParams? params, Duration? interval}) Stream<Response<int>>
Method to listenCount data with optional data source builder.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ref(DataFieldParams? params, DataModifiers modifier, [String? id]) String
Method to check data by query with optional data source builder.
toString() String
A string representation of this object.
inherited
updateById(String id, Map<String, dynamic> data, {DataFieldParams? params, bool? resolveRefs, Ignore? ignore, bool updateRefs = false}) Future<Response<T>>
Method to update data by ID with optional data source builder.
updateByIds(Iterable<DataWriter> updates, {DataFieldParams? params, bool? resolveRefs, Ignore? ignore, bool updateRefs = false}) Future<Response<T>>
Method to update data by multiple IDs with optional data source builder.

Operators

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