SubCollectionModel<T extends Model> class
abstract
- Inheritance
-
- Object
- FirestoreModel<
T> - SubCollectionModel
Constructors
Properties
- collectionName → String
-
collection name FirestoreModel use your Model name
no setteroverride
- createdAt ↔ DateTime?
-
DateTime when document is created
getter/setter pairinherited
- docId ↔ String?
-
document id FirestoreModel will get it for your model
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isUpdating ↔ bool
-
getter/setter pairinherited
- parentPath ↔ String?
-
we will fill it if model is SubCollection
getter/setter pairinherited
- path ↔ String?
-
A string representing the path of the referenced document (relative to the
root of the database).
getter/setter pairinherited
- perPage → int
-
default items in page
no setterinherited
-
responseBuilder
→ ResponseBuilder<
T> -
model mapping to write in collection
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- subCollectionName → String
-
no setter
-
toMap
→ Map<
String, dynamic> -
model mapping to write in collection
no setterinherited
- updatedAt ↔ DateTime?
-
DateTime when document is updated
getter/setter pairinherited
- withTimestamps → bool
-
default true set timestamps
no setterinherited
Methods
-
all(
) → Future< List< T?> > -
To get all documents call all
List
inherited
-
arrayRemove(
{required String field, required List elements, String? docId}) → Future< void> -
update
field
realtime value tells the server to remove the givenelements
from any array value that already exists on the server.inherited -
arrayUnion(
{required String field, required List elements, String? docId}) → Future< void> -
update
field
realtime value tells the server tounion
the givenelements
with any array value that already exists on the server.inherited -
bulkDelete(
{List< String> ? docsIds, Query<Object?> query(Query<Object?> query)?}) → Future<void> -
delete more one document model call bulkDelete
delete specific models use bulkDelete by pass
docsIds
FirestoreModel.useinherited -
bulkUpdate(
{List< String> ? docsIds, required Map<String, Object?> data, Query<Object?> query(Query<Object?> query)?}) → Future<void> -
inherited
-
create(
{String? docId}) → Future< T?> -
To Write in firestore database
call create method from your model like this:
user.create();
if you have
docId
for doc: user.create(docId: 'doc_id'); return model after createinherited -
decrement(
{required String field, String? docId, num value = 1}) → Future< void> -
update
field
realtime value that tells the server to decrement thefield
’s currentvalue
by the givenvalue
.inherited -
delete(
{String? docId}) → Future< void> -
delete current model call delete
user.delete();
delete specific model use delete by pass docId:
FirestoreModel.use
inherited
-
exists(
String docId) → Future< bool> -
check if document is exists call exists by
docId
bool isExists = await FirestoreModel.useinherited -
find(
String docId) → Future< T?> -
To get document data by document id call find and pass
docId
User user = await FirestoreModel.useinherited -
first(
{Query< Object?> queryBuilder(Query<Object?> query)?}) → Future<T?> -
To get first result from your collection call first
you can build your query like where orderBy or any query buildr methods in
queryBuilder
User firstUser = await FirestoreModel.useinherited -
get(
{Query< Object?> queryBuilder(Query<Object?> query)?, Query<Object?> ? query}) → Future<List< T?> ?> -
To get results from your collection call get
you can build your query like where orderBy or any query buildr methods in
queryBuilder
Listinherited -
getSubCollection(
String subCollection, {String? docId, Query< Object?> queryBuilder(Query<Object?> query)?}) → Future<List< T?> ?> -
inherited
-
increment(
{required String field, String? docId, num value = 1}) → Future< void> -
update
field
realtime value that tells the server to increment thefield
’s currentvalue
by the givenvalue
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
paginate(
{int? perPage, Query< Object?> queryBuilder(Query<Object?> query)?}) → Future<List< T?> > -
To get results limit and load more as pagination from your collection call paginate
you can build your query like where orderBy or any query buildr methods in
queryBuilder
you can setperPage
in your call or set in your model Listinherited -
remove(
{required String field, String? docId}) → Future< void> -
remove
field
from documentinherited -
save(
{String? docId, SetOptions? setOptions}) → Future< void> -
make changes to your model and call save
user.firstName = 'new firstname';
user.save()
inherited
-
streamAll(
) → Stream< List< ?T?> > -
To stream all documents call streamAll
Stream<List
inherited
-
streamFind(
String docId) → Stream< T?> -
To stream document data by document id call streamFind as pass
docId
Streaminherited -
streamFirst(
{Query< Object?> queryBuilder(Query<Object?> query)?, dynamic onChange(T? dataChange)?}) → Stream<T?> -
To stream document data by document id call streamFind as pass docId
Stream
inherited
-
streamGet(
{Query< Object?> queryBuilder(Query<Object?> query)?, Query<Object?> ? query, dynamic onChange(List<T?> chnagesData)?}) → Stream<List< T?> ?> -
To stream results from your collection call streamGet with
queryBuilder
Stream<Listinherited -
streamPaginate(
{int? perPage, Query< Object?> queryBuilder(Query<Object?> query)?}) → Stream<List< T?> > -
To stream results from your collection call streamPaginate
Stream<List
inherited
-
streamSubCollection(
String subCollection, {String? docId, Query< Object?> queryBuilder(Query<Object?> query)?}) → Stream<List< T?> ?> -
inherited
-
subCollection<
S extends Model> ({String? path}) → S -
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
{String? docId, required Map< String, Object?> data}) → Future<void> -
update specific fields in your model call update by pass
data
user.update(data: { "first_name": "Mohamed", "last_name": "Abdullah" }) update specific model use update by passdocId
anddata
FirestoreModel.useinherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited