From 29e9e7f1e428ef946ca8cd46fdd891efb659f98c Mon Sep 17 00:00:00 2001 From: xAlpharax <42233094+xAlpharax@users.noreply.github.com> Date: Sun, 5 Nov 2023 05:24:13 +0200 Subject: Added logic with Firebase and the supplied lib for RTDB - (Real Time Database) Changes to be committed: modified: client_app_flutter/lib/main.dart modified: client_app_flutter/pubspec.lock modified: client_app_flutter/pubspec.yaml --- client_app_flutter/lib/main.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'client_app_flutter/lib/main.dart') diff --git a/client_app_flutter/lib/main.dart b/client_app_flutter/lib/main.dart index e00d0ae..31bc250 100644 --- a/client_app_flutter/lib/main.dart +++ b/client_app_flutter/lib/main.dart @@ -3,9 +3,13 @@ import 'package:flutter/material.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:client_app_flutter/firebase_options.dart'; +import 'package:firebase_database/firebase_database.dart'; + Future main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); + + // FirebaseDatabase database = FirebaseDatabase.instance; runApp(const MyApp()); } @@ -60,6 +64,7 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { + FirebaseDatabase database = FirebaseDatabase.instance; int _counter = 0; void _incrementCounter() { @@ -69,7 +74,8 @@ class _MyHomePageState extends State { // 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++; + _counter = database.hashCode; }); } -- cgit v1.2.3