DatabaseObject class abstract
An abstract class representing a database object.
- Implementers
Constructors
-
DatabaseObject.new({DocumentReference<
Object?> ? ref}) -
Constructs a DatabaseObject with an optional
ref
.
Properties
Methods
-
create(
CollectionReference< Object?> d) → Future<void> -
Creates a new document in the specified
CollectionReference
and sets the ref to the newly created document. -
createInPath(
String d) → Future< void> - Creates a new document in the specified collection path and sets the ref to the newly created document.
-
createWithPath(
String d) → Future< void> - Creates a new document with the specified path and sets the ref to the newly created document.
-
delete(
) → Future< void> - Deletes the document referenced by ref.
-
fromMap(
Map< String, dynamic> d) → void - Populates the object from a map representation.
-
fromSnapshot(
DocumentSnapshot< Object?> d) → void -
Populates the object from a
DocumentSnapshot
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reload(
) → Future< void> - Reloads the data of the document referenced by ref.
-
toMap(
) → Map< String, dynamic> - Converts the object to a map representation.
-
toReference<
T extends DatabaseObject> (T create(), [String? name]) → FirebaseObjectReference< T> - Returns the string representation of the object.
-
toString(
) → String -
A string representation of this object.
override
-
update(
[DocumentReference< Object?> ? refe]) → Future<void> -
Updates the document referenced by ref with the current data.
If
refe
is provided, it sets the ref to the new reference.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
loadAllFromCollection<
T extends DatabaseObject> (CollectionReference< Object?> collection, T creator()) → Future<List< T> > -
Loads all DatabaseObjects from a
CollectionReference
using a creator function. -
loadAllFromQuery<
T extends DatabaseObject> (Query< Object?> query, T creator()) → Future<List< T> > -
Loads all DatabaseObjects from a
Query
using a creator function. -
loadAllFromSnapshot<
T extends DatabaseObject> (QuerySnapshot< Object?> snapshot, T creator()) → List<T> -
Loads all DatabaseObjects from a
CollectionReference
using a creator function. -
loadFromPath<
T extends DatabaseObject> (String path, T creator()) → Future< T> - Loads a DatabaseObject from a document path using a creator function.
-
loadReference<
T extends DatabaseObject> (DocumentReference< Object?> ref, T creator()) → Future<T> -
Loads a DatabaseObject from a
DocumentReference
using a creator function. -
loadSnapshot<
T extends DatabaseObject> (DocumentSnapshot< Object?> d, T creator()) → T -
Loads a DatabaseObject from a
DocumentSnapshot
using a creator function.