flutterfire_oop_modeler 0.0.5 copy "flutterfire_oop_modeler: ^0.0.5" to clipboard
flutterfire_oop_modeler: ^0.0.5 copied to clipboard

A OOP modeler for Firebase Firestore in Dart to create, read, update and delete documents in a Firestore database.

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'];
  }
}

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);

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);

2
likes
160
pub points
26%
popularity

Publisher

unverified uploader

A OOP modeler for Firebase Firestore in Dart to create, read, update and delete documents in a Firestore database.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

cloud_firestore, firebase_core, flutter

More

Packages that depend on flutterfire_oop_modeler