0
votes

I am a very simple human being. I need simple things in life. I just want to get a value as int/String/float from a KNOWN not dynamic child from realtime database, simple. no multiple values, no complex physics theory behind networking. I have seen tons of Stackoverflow on how to retrieve data into list, dynamic child, oh no. not me please. I just need a very simple single value from Database. I will show u the database structure below: Realtime Database

I just need to get the value of "rewardAtEvery" as int. that's all nothing more, nothing less. I can live in peace afterward. Thanks a lot

1

1 Answers

0
votes

another human being here. These are the steps you can follow to achieve it:

  1. Import the firebase realtime database dependence in your pubspec.yaml:
dependencies:
 ...
 firebase_database: ^4.1.1
  1. import the package in your .dart file:
import 'package:firebase_database/firebase_database.dart';
  1. Use it like this:
DataSnapshot snap =
      await FirebaseDatabase.instance.reference().child("path/to/Attributes/rewardAtEvery").once();

dynamic value = snap.value;