Last updated:
0 purchases
flutterfire oop modeler
A Object Like Model put on Firebase Firestore Database to make Modelling Databases easier and faster
Features #
Getting started #
Install the with flutter pub add firebase_oop_modeler
Usage #
Create an DatabaseObject with input and output function it will be 1:1 representet in your Database
class TestObject extends DatabaseObject {
String? name;
int? age;
TestObject({this.name, this.age, super.ref});
@override
Map<String, dynamic> toMap() {
return {
'name': name,
'age': age,
};
}
@override
void fromMap(Map<String, dynamic> d) {
name = d['name'];
age = d['age'];
}
}
copied to clipboard
Loading data from Firebase #
You can load Objects of a Type from the database with the following functions:
TestObject to = loadSnapshot(DocumentSnapshot d, TestObject.new);
TestObject to = await loadReference(DocumentReference d, TestObject.new);
TestObject to = await loadAllFromPath("users/user1", TestObject.new);
copied to clipboard
Collection API #
You can scan Collections with the following functions:
// Not Reccomended
DatabaseList<TestObject> lo = fromQuerySnapshot(CollectionReference d, QuerySnapshot l, TestObject.new);
DatabaseList<TestObject> lo = loadCollection(CollectionReference d, TestObject.new);
DatabaseList<TestObject> lo = loadAllFromPath("user", TestObject.new);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.