summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxAlpharax <42233094+xAlpharax@users.noreply.github.com>2023-11-05 06:01:37 +0200
committerxAlpharax <42233094+xAlpharax@users.noreply.github.com>2023-11-05 06:01:37 +0200
commit116a9a349e11e059eaeddea88cd29d585bb9bfa0 (patch)
treec2f233e64e4f1058069d507e38a04d4dffc51474
parent29e9e7f1e428ef946ca8cd46fdd891efb659f98c (diff)
Working with the DB.
Changes to be committed: modified: lib/main.dart
-rw-r--r--client_app_flutter/lib/main.dart14
1 files changed, 12 insertions, 2 deletions
diff --git a/client_app_flutter/lib/main.dart b/client_app_flutter/lib/main.dart
index 31bc250..5fd98b4 100644
--- a/client_app_flutter/lib/main.dart
+++ b/client_app_flutter/lib/main.dart
@@ -65,6 +65,8 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
FirebaseDatabase database = FirebaseDatabase.instance;
+ // final ref = FirebaseDatabase.instance.ref();
+
int _counter = 0;
void _incrementCounter() {
@@ -74,8 +76,16 @@ class _MyHomePageState extends State<MyHomePage> {
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
- // _counter++;
- _counter = database.hashCode;
+ _counter++;
+ // final snapshot = await ref.child('temperature').get();
+ final snapshot = database.ref().child('temperature').get();
+ // if (snapshot.exists) {
+ // print(snapshot.value);
+ // var _counter = snapshot.value;
+ // } else {
+ // print('No data available.');
+ // }
+ // // _counter = ref.child('temperature').get() as int;
});
}