0 points

Real time database CRUD


dashboard

Sun Jun 14 2020 07:08:20 GMT+0000 (UTC)

Posted by @pratik.gtm #dart

final ref = FirebaseDatabase.instance.reference();

 void getData() {
    ref
        .child('videos')
        .child('class_10')
        .child('chapter_1')
        .once()
        .then((DataSnapshot data) {
      print(data.value);
      print(data.key);
    });
  }
  
    void createRecord() {
    ref
        .child('videos')
        .child('class_10')
        .child('chapter_1')
        .set([
      {"length": "1:3333", "title": "Introduction 1.1"},
      {"length": "2:30", "title": "Introduction 1.2"}
    ]);
  }
content_copy Copy

.yaml file: firebase_database: ^3.1.1

https://petercoding.com/firebase/2020/02/06/get-started-with-firebase-in-flutter/